<?php ini_set('html_errors', 0); $xml = <<<XML <?xml version="1.0"?> <epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0.xsd" > <resData> <domain:chkData xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd"> <domain:cd> <domain:name avail="1">bar.com</domain:name> </domain:cd> <domain:cd> <domain:name avail="1">foo.com</domain:name> </domain:cd> </domain:chkData> </resData> </epp> XML; $sxe = simplexml_load_string($xml); /** Just try to match any cd node we can find */ var_dump($sxe->xpath('//cd')); /** Now we go through all children manually */ $i = $j = $k = 0; foreach ($sxe->children() as $resData) { var_dump($i++); foreach ($resData->children() as $chkData) { var_dump($j++); foreach ($chkData->children() as $cd) { var_dump($k++); var_dump($cd); var_dump($cd->I_dont_exist); } } } /** OK great... now we try to find it through its namespace */ var_dump($sxe->xpath('//domain:cd')); /** So what do we know? Not much for certain without checking out the source code, but libxml2 support for XML schemas is incomplete. We know that xmlXPathEval failed to evaluate the namespace... and since this is a libxml2 function I would doubt any PHP function would be able to interpret namespaces correctly... or at least you have to register the namespace somehow... */ ?> -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-general&w=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
Attachment:
signature.asc
Description: OpenPGP digital signature