PHP xml_parser_set_option() Function
In this chapter you will learn:
- Description for PHP xml_parser_set_option() Function
- Syntax for PHP xml_parser_set_option() Function
- Parameter for PHP xml_parser_set_option() Function
- Return for PHP xml_parser_set_option() Function
- Example - sets options in an XML parser
Description
The xml_parser_set_option() function sets options in an XML parser.
Syntax
PHP xml_parser_set_option() Function has the following syntax.
xml_parser_set_option(parser,option,value)
Parameter
Parameter | Is Required | Description |
---|---|---|
parser | Required. | XML parser to use |
option | Required. | option to set. |
value | Required. | options new value |
Possible values for option:
- XML_OPTION_CASE_FOLDING - if case-folding is enabled. Enabled by default. Can be 1 (TRUE) or 0 (FALSE)
- XML_OPTION_SKIP_TAGSTART - how many characters should be skipped in the beginning of a tag name
- XML_OPTION_SKIP_WHITE - whether to skip values consisting of whitespace characters. Can be 1 (TRUE) or 0 (FALSE)
- XML_OPTION_TARGET_ENCODING - which target encoding to use in this XML parser. By default, it is set to the same as the xml_parser_create() function. Supported target encodings are ISO-8859-1, US-ASCII and UTF-8.
Return
This function returns TRUE on success, or FALSE on failure.
Example
Set options in an XML parser
<?php/*from j a v a 2 s . co m*/
$xmlparser = xml_parser_create();
xml_parser_set_option($xmlparser, XML_OPTION_SKIP_WHITE, 1);
xml_parser_free($xmlparser);
?>
Next chapter...
What you will learn in the next chapter:
- Description for PHP xml_set_character_data_handler() Function
- Syntax for PHP xml_set_character_data_handler() Function
- Parameter for PHP xml_set_character_data_handler() Function
- Notes for PHP xml_set_character_data_handler() Function
- Return for PHP xml_set_character_data_handler() Function
- Example - Set the character data handler for the XML parser
Home » PHP Tutorial » PHP XML Functions