summaryrefslogtreecommitdiff
path: root/xml.class
diff options
context:
space:
mode:
Diffstat (limited to 'xml.class')
-rw-r--r--xml.class13
1 files changed, 7 insertions, 6 deletions
diff --git a/xml.class b/xml.class
index 36aa165..24a9f23 100644
--- a/xml.class
+++ b/xml.class
@@ -22,7 +22,8 @@ class it_xml
* forcearray xml tags to ALWAYS return as array
* safety value 2 causes program abort with invalid xml, 1 causes error report
* encoding Output character encoding (e.g. UTF-8, default: ISO-8859-1)
- * prefix Optional prefix for class names
+ * prefix Optional prefix for class names
+ * lowercase Lowercase all tag and attribute names
* @return XML object tree or null on failure
*/
@@ -132,13 +133,13 @@ function flatten($with_attr = false)
# Strip namespace and convert extra characters to _
function _make_identifier($name)
{
- return preg_replace(array('/^.*:/', '/\W/'), array('', '_'), $name);
+ $id = preg_replace(array('/^.*:/', '/\W/'), array('', '_'), $name);
+ return $this->_p['lowercase'] ? strtolower($id) : $id;
}
function start_element($parser, $name, $attrs)
{
- $name = it_xml::_make_identifier($name);
- $name = $this->_p['prefix'] . $name;
+ $name = $this->_p['prefix'] . $this->_make_identifier($name);
if (!class_exists($name))
eval("class $name extends it_xml {}"); # Extending the base class caused problems with tel_xmlentry
@@ -154,13 +155,13 @@ function start_element($parser, $name, $attrs)
if ($attrs)
{
foreach ($attrs as $key => $val)
- $this->_stack[0]->attr[it_xml::_make_identifier($key)] = $val;
+ $this->_stack[0]->attr[$this->_make_identifier($key)] = $val;
}
}
function end_element($parser, $name)
{
- $name = it_xml::_make_identifier($name);
+ $name = $this->_make_identifier($name);
if (!$this->_stack[0]->consume($this->_p))
{