diff options
author | Olav Morken <olav.morken@uninett.no> | 2011-11-03 12:41:34 +0000 |
---|---|---|
committer | Olav Morken <olav.morken@uninett.no> | 2011-11-03 12:41:34 +0000 |
commit | 87d724a5988c31ee4f05bf0691117f96615d17bf (patch) | |
tree | ccc7bd046ec99305d2ca708d80206463e089a053 /lib/SAML2/Utils.php | |
parent | 65b66e7e779fef9cfd181c5c61fcf0d2d33d957d (diff) | |
download | simplesamlphp-87d724a5988c31ee4f05bf0691117f96615d17bf.zip simplesamlphp-87d724a5988c31ee4f05bf0691117f96615d17bf.tar.gz simplesamlphp-87d724a5988c31ee4f05bf0691117f96615d17bf.tar.bz2 |
SAML2_Utils: Change extractStrings to take the namespaceURI and localname instead of an XPath query.
git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2971 44740490-163a-0410-bde0-09ae8108e29a
Diffstat (limited to 'lib/SAML2/Utils.php')
-rw-r--r-- | lib/SAML2/Utils.php | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/SAML2/Utils.php b/lib/SAML2/Utils.php index d952434..0e37acc 100644 --- a/lib/SAML2/Utils.php +++ b/lib/SAML2/Utils.php @@ -458,15 +458,20 @@ class SAML2_Utils { /** * Extract strings from a set of nodes. * - * @param DOMElement $parent The element we should rund the XPath query on. - * @param string $query The XPath query we should use to retrieve the nodes. + * @param DOMElement $parent The element that contains the localized strings. + * @param string $namespaceURI The namespace URI the string elements should have. + * @param string $localName The localName of the string elements. * @return array The string values of the various nodes. */ - public static function extractStrings(DOMElement $parent, $query) { - assert('is_string($query)'); + public static function extractStrings(DOMElement $parent, $namespaceURI, $localName) { + assert('is_string($namespaceURI)'); + assert('is_string($localName)'); $ret = array(); - foreach (self::xpQuery($parent, $query) as $node) { + for ($node = $parent->firstChild; $node !== NULL; $node = $node->nextSibling) { + if ($node->namespaceURI !== $namespaceURI || $node->localName !== $localName) { + continue; + } $ret[] = trim($node->textContent); } |