PHP Function Reference

PHP xml_parser_create_ns() Function



The PHP xml_parser_create_ns() function creates a new XML parser with XML namespace support and returns a XMLParser instance to be used by the other XML functions.

Syntax

xml_parser_create_ns(encoding, separator)

Parameters

encoding Optional. It specifies the output encoding. Input encoding is automatically detected, so that the encoding parameter specifies only the output encoding. The default output charset is UTF-8. The supported encodings are ISO-8859-1, UTF-8 and US-ASCII.
separator Optional. Specify the output separator for tag name and namespace. Default is ":".

Return Value

Returns a new XMLParser instance.

Example: xml_parser_create_ns() example

In the example below, an XML parser with namespace support is created using xml_parser_create_ns() function. Then parser is freed using xml_parser_free() function.

<?php
//create an XML parser with namespace support
$parser=xml_parser_create_ns();

//free the XML parser
xml_parser_free($parser);
?>

❮ PHP XML Parser Reference