getNamespaces
Returns the namespace used in the document.
getNamespaces()
function returns the namespace used in the XML document.
Returns all namespaces used in the XML document:
<?php $xml = << < XML < ? xml version = "1.0" standalone = "yes" ?> < cars xmlns: c = " http://gitbox.net/ns " xmlns: a = " http://gitbox.net/country " > < c: car id = " 1 " > Volvo </ c: car > < c: car id = " 2 " > BMW </ c: car > < c: car id = " 3 " > Saab </ c: car > </ cars > XML; $sxe=new SimpleXMLElement($xml); $ns=$sxe->getNamespaces(true); var_dump($ns); ?>
Run the instance
SimpleXMLElement :: getNamespaces ( recursive )
parameter | describe |
---|---|
Recursive |
Optional. Specifies a boolean value. If TRUE, return all namespaces used in the document; If FALSE, only the namespace used in the root node is returned. The default is FALSE. |