Latest web development tutorials

PHP xml_parser_create () function

PHP XML Reference Complete PHP XML Reference

Definition and Usage

xml_parser_create () function to create XML parser.

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(encoding)

参数 描述
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。



Tips and Notes

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

Tip: To create an XML parser with namespace support, use xml_parser_create_ns () function.


Examples

<?php
$xmlparser = xml_parser_create();

xml_parser_free($xmlparser);
?>


PHP XML Reference Complete PHP XML Reference