Easy Tutorial
❮ Func Curl_Pause Php Curl ❯

PHP getDocNamespaces() Function

PHP SimpleXML Reference Manual

Example

Return the namespaces declared in the root node of the XML document:


Definition and Usage

The getDocNamespaces() function returns the namespaces declared in the XML document.


Syntax

Parameter Description
recursive Optional. Specifies a boolean value. If set to TRUE, it returns all namespaces declared in all parent and child nodes. If set to FALSE, it returns only the namespaces declared in the root node. Default is FALSE.
from_root Optional. Specifies a boolean value. If set to TRUE, it checks the namespaces in the root node of the XML document. If set to FALSE, it checks the namespaces under the child nodes. Default is TRUE.

Technical Details

Return Value: Returns an array of namespace names with their associated URIs.
PHP Version: 5.1.2+
--- ---
PHP Changelog: PHP 5.4: Added the from_root parameter.
--- ---

More Examples

Example 1

Return all namespaces declared in the parent and child nodes of the XML document:


❮ Func Curl_Pause Php Curl ❯