This should work perfectly. Thanks a lot!
David
---------------------------
Hello David,
I had the same problem some weeks before and solved it with the use of xpath (thus it isn't in the dom documentation of w3c but you'll find it under xpath recommendation):
<pre>
<?php
$xml = "<prefix:localName xmlns:prefix=\"http://anynamespace.tld/\">nodeValue</prefix:localName>";
$doc = new DOMDocument();
$doc->loadXML($xml);
$xpath = new DOMXPath($doc);
$result = $xpath->query("//namespace::*");
foreach($result as $node) {
print $node->localName . " = " . $node->nodeValue . "\n";
}
?> </pre>
The xpath expression "//namespace::*" selects all nodes of the namespace axis, the namespaces. Maybe it is a bit heavy for bigger documents to traverse all nodes but it does its work...
If this is an acceptable solution to your problem, it would be nice if you could post our conversation on php.xml.dev news repository (news.php.net, but i think you'll know:). Thanks.
Furhter it would be nice if you would take just a minute to get to know my new project called eecoo - if you're interested in oop concepts of php5 and of course xml & co. you'll there be quite right!! You can find it under http://eecoo.dyndns.info/~brainbug/ (leave out ~brainbug to see the developement server, but currently under construction).
Thanks, and nice to meet you. hope i could help. Bye
vivi
------------------
ORIGINAL EMAIL ------------------
Vivian Steller,
Hi, I saw your documentation of PHP5's DOM at http://www.eecoo.de/downloads/domdocumentation.txt and was wondering if you could help me solve a issue. I have been using W3's website to figure out everything I know about PHP's DOM since they follow it very closesly. On a project I am working on I need a list of all the namespaces in the dom document. I find that you can get the namespcace uri if you have the prefix and the prefix if you have the namespace uri, but i can not find out how to get a complete list. I do see the NameList (DOMNodeList in PHP5) but I see no way of getting to it; or even if it is implemented.
Anyways, my question is if your have learned of a way to get a complete list of namespace uri's (or namespace prefixes) when using PHP5's DOM?
Thanks a lot for any help you can provide.
David Schlotfeldt
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php