From 0ecfe47a8aa78fa065284fe74bba628bde9de181 Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Sat, 28 Feb 2009 16:51:12 +0100 Subject: [PATCH] Use getAttributeNodeNS() to kill a tiny bit of PHP5 code. --- php5/xml-template.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/php5/xml-template.php b/php5/xml-template.php index b28db15..e6a4e19 100644 --- a/php5/xml-template.php +++ b/php5/xml-template.php @@ -49,14 +49,13 @@ function XML_Template_process($node, $obj, $clean = 1) if (isset($attrs)) { $replace_child = 0; - foreach ($child->attributes as $attr) { - if ($attr->namespaceURI == 'http://template.sesse.net/' && $attr->name == 'id') { - $id = $attr->value; - if ($clean) { - $child->removeAttributeNode($attr); - $replace_child = 1; - } - } + $id_node = $child->getAttributeNodeNS('http://template.sesse.net/', 'id'); + if (isset($id_node)) { + $id = $id_node->value; + if ($clean) { + $child->removeAttributeNode($id_node); + $replace_child = 1; + } } # This seems to be the only way to reliably get rid of the excess -- 2.39.2