SimpleXMLElement::getDocNamespaces Returns namespaces declared in document &reftitle.description; public arrayfalseSimpleXMLElement::getDocNamespaces boolrecursive&false; boolfromRoot&true; Returns namespaces declared in document &reftitle.parameters; recursive If specified, returns all namespaces declared in parent and child nodes. Otherwise, returns only namespaces declared in root node. fromRoot Allows you to recursively check namespaces under a child node instead of from the root of the XML doc. &reftitle.returnvalues; The getDocNamespaces method returns an array of namespace names with their associated URIs. &reftitle.examples; Get document namespaces John Doe Susie Q. Public XML; $sxe = new SimpleXMLElement($xml); $namespaces = $sxe->getDocNamespaces(); var_dump($namespaces); ?> ]]> &example.outputs; string(21) "http://example.org/ns" } ]]> Working with multiple namespaces John Doe Susie Q. Public XML; $sxe = new SimpleXMLElement($xml); $namespaces = $sxe->getDocNamespaces(TRUE); var_dump($namespaces); ?> ]]> &example.outputs; string(21) "http://example.org/ns" ["t"]=> string(23) "http://example.org/test" ["a"]=> string(23) "http://example.org/addr" } ]]> &reftitle.seealso; SimpleXMLElement::getNamespaces SimpleXMLElement::registerXPathNamespace