In this article I describe the PHP XML Parser functions xml_parser_create, xml_parser_free, xml_parser_get_option, xml_parser_set_option and xml__set_character_data_handler . To learn some other PHP XML Parser functions go to:
PHP xml_parser_create() Function
The PHP XML Parser "xml_parser_create" function is used to create an XML parser.
Syntax
| xml_parser_create(encoding) |
Parameter of the xml_parser_create function
The parameter of the function is:
| Parameter | Description |
| encoding | It specifies the output encoding and it's possible values are:
|
Example
An example of the function is:
<?php
$xmlparser = xml_parser_create();
xml_parser_free($xmlparser);
?>
PHP xml_parser_free() Function
The PHP XML Parser "xml_parser_free" function frees an XML parser and this function returns FALSE if parser does not refer to a valid parser, or else it frees the parser and returns TRUE.
Syntax
| xml_parser_free(parser) |
Parameter of the xml_parser_free function
The parameter of the function is:
| Parameter | Description |
| parser | It specifies the XML parser to free. |
Example
An example of the function is:
<?php
$xmlparser = xml_parser_create();
xml_parser_free($xmlparser);
?>
PHP xml_parser_get_option() Function
The PHP XML Parser "xml_parser_get_option" function is used to get options from an XML parser and this function returns FALSE if parser does not refer to a valid parser otherwise option's value is returned.
Syntax
| xml_parser_get_option(parser,option,value) |
Parameters of the xml_parser_get_option function
The parameters of the function are:
| Parameter | Description |
| parser | It specifies the XML parser to use. |
| option | It specifies the option to get and it's possible values are:
|
| value | It specifies options new value. |
Example
An example of the function is:
<?php
$xmlparser = xml_parser_create();
xml_parser_get_option($xmlparser, XML_OPTION_SKIP_WHITE, 1);
xml_parser_free($xmlparser);
?>
PHP xml_parser_set_option() Function
The PHP XML Parser "xml_parser_set_option" function sets options in an XML parser and this function returns false if parser does not refer to a valid parser otherwise the option is set and true is retuned.
Syntax
| xml_parser_get_option(parser,option,value) |


Join the conversation! Your thoughts help the community grow.