PHP xml_parser_create_ns() ਫੰਕਸ਼ਨ

ਪਰਿਭਾਸ਼ਾ ਅਤੇ ਵਰਤੋਂ

xml_parser_create_ns() 函数 ਨਾਮ ਸਪੇਸ ਸਮਰਥਤ ਐਕਸਮਲ ਐਕਸ ਪਾਰਸਰ ਬਣਾਉਂਦਾ ਹੈ。

This function creates a new XML parser and returns a resource handle that can be used by other XML functions.

Syntax

xml_parser_create_ns(encoding,separator)
Parameter Description
encoding Optional. Specifies the output encoding.
encoding Optional. Specifies the separator for the output of tag names and namespaces. The default is ":".

Description

Optional Parameter encoding In PHP 4, used to specify the character encoding of the XML input to be parsed.

Starting with PHP 5, the input encoding of XML is automatically detected, so encoding The parameter is used only to specify the encoding of the output data after parsing.

In PHP 4, the default output encoding is the same as the encoding of the input data. If an empty string is passed, the parser will try to search the first 3 or 4 bytes to determine the document encoding.

In PHP 5.0.0 and 5.0.1, the default character encoding of the output is ISO-8859-1, while PHP 5.0.2 and above versions are UTF-8.

The encodings supported by the parser are ISO-8859-1, UTF-8, and US-ASCII.

Tips and Comments

Tip:To release the XML parser, use xml_parser_free(); Function.

Tip:To create an XML parser without namespace support, use xml_parser_create(); Function.

Example

<?php
$xmlparser = xml_parser_create_ns();;
xml_parser_free($xmlparser);
?>