aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_xml.inc.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/functions_xml.inc.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/functions_xml.inc.php b/include/functions_xml.inc.php
index d37537fa1..64df545ce 100644
--- a/include/functions_xml.inc.php
+++ b/include/functions_xml.inc.php
@@ -53,9 +53,18 @@ function getAttribute( $element, $attribute )
{
// echo htmlentities($element).'<br /><br />';
$regex = '/^<\w+[^>]*'.$attribute.'\s*=\s*"('.VAL_REG.')"/i';
- if ( preg_match( $regex, $element, $out ) ) return $out[1];
+ if ( preg_match( $regex, $element, $out ) )
+ {
+ return html_entity_decode($out[1], ENT_QUOTES);
+ }
else return '';
}
+
+// The function encode Attribute returns the xml attribute $attribute="$value"
+function encodeAttribute( $attribute, $value )
+{
+ return $attribute.'="'.htmlspecialchars($value, ENT_QUOTES).'" ';
+}
// The function getChild returns the first child
// exemple : getChild( "<table><tr>XXX</tr><tr>YYY</tr></table>", "tr" )