The getNamespaces() function returns the namespaces used in an XML document.
public array SimpleXMLElement::getNamespaces ([ bool $recursive = FALSE ] )
Returns namespaces used in document
The above example will output:
array(1) { ["p"]=> string(21) "http://example.org/ns" }
Parameter | Description |
---|---|
recursive | If specified, returns all namespaces used in parent and child nodes. Otherwise, returns only namespaces used in root node. |
The getNamespaces method returns an array of namespace names with their associated URIs.