PHP xml_parser_set_option() Function
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 ww w . ja v a 2 s. c o m
$xmlparser = xml_parser_create();
xml_parser_set_option($xmlparser, XML_OPTION_SKIP_WHITE, 1);
xml_parser_free($xmlparser);
?>