Enumerate registered namespaces of a PHP DOMDocument object

Posted by zneak on Stack Overflow See other posts from Stack Overflow or by zneak
Published on 2010-04-03T19:19:34Z Indexed on 2010/04/03 19:23 UTC
Read the original article Hit count: 454

Filed under:
|
|

Hello world,

For one of my projects, I'm using the DOMDocument class to load and manipulate XML documents.

I'd need to retrieve every namespace used in the document; however, I can't find how I'd do that. The DOMDocument class has methods to get the namespace prefix of an URI or the URI of a namespace prefix, but I've seen nothing to actually enumerate registered namespaces.

The SimpleXML library has a getNamespaces() method for that. Is there an equivalent for DOMDocument?

© Stack Overflow or respective owner

Related posts about php

Related posts about simplexml