PHP registerXPathNamespace() Function
PHP SimpleXML Reference Manual
Example
Create a namespace context for the next XPath query:
"; } ?>
Run Example »
Definition and Usage
The registerXPathNamespace() function creates a namespace context for the next XPath query.
This function is useful if the namespace prefix changes in the XML document. registerXPathNamespace() creates a specified namespace prefix so that the affected XML nodes can be accessed without changing the application code too much.
Syntax
registerXPathNamespace(
prefix
,
ns
);
| Parameters | Description |
|---|---|
| prefix | Required. Specifies the ns namespace prefix used in the XPath query for the specified namespace. |
| ns | Required. Specifies the namespace to use for the XPath query. |
Technical Details
| Return Value: | Returns TRUE on success, FALSE on failure. |
|---|---|
| PHP Version: | 5.2+ |
PHP SimpleXML Reference Manual