Latest web development tutorials

PHP xml_parser_create_ns () function

PHP XML Reference Complete PHP XML Reference

Definition and Usage

xml_parser_create_ns () function to create XML parser with namespace support.

If successful, the function returns a resource handle that can be used by other XML functions. If it fails, it returns FALSE.

grammar

xml_parser_create_ns(encoding,separator)

参数 描述
encoding 可选。规定输出编码。在 PHP 5.0.2 及以上的版本中,默认是 UTF-8。

可能的值:

  • ISO-8859-1
  • UTF-8
  • US-ASCII.

注释:在 PHP 5 中,输入编码会被自动侦测。在 PHP 4 及之前的版本中,该参数规定输入和输出的字符编码。

注释:在 PHP 5.0.0 和 5.0.1 中,默认的输出字符集是 ISO-8859-1。

separator 可选。规定标签名和命名空间的输出分隔符。默认是 " : "。


Tips and Notes

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

Tip: To create a namespace does not support XML parser, use xml_parser_create () function.


Examples

<?php
$xmlparser = xml_parser_create_ns();

xml_parser_free($xmlparser);
?>


PHP XML Reference Complete PHP XML Reference