PHP xml_parser_set_option() function

Definition and usage

xml_parser_set_option () function sets options for XML parsing.

If successful, the function returns TRUE. If it fails, it returns FALSE.


xml_parser_set_option (parser, option, value)

parameters description
parser Required. Specifies the XML parser to use.
option Required. Specifies the options to be set. Possible values:
  • XML_OPTION_CASE_FOLDING-Specifies whether case-folding is allowed. Allowed by default. Can be 1 (TRUE) or 0 (FALSE).
  • XML_OPTION_SKIP_TAGSTART-specifies the number of characters that should be skipped at the beginning of the tag name.
  • XML_OPTION_SKIP_WHITE-Specifies whether to skip values ​​consisting of space characters. Can be 1 (TRUE) or 0 (FALSE).
  • XML_OPTION_TARGET_ENCODING-Specifies which target encoding is used in the XML parser. By default, it is set the same as the xml_parser_create () function, and it supports the target encodings: ISO-8859-1, US-ASCII, and UTF-8.
value Necessary. Specifies a new value for the option.


$xmlparser = xml_parser_create();

xml_parser_set_option($xmlparser, XML_OPTION_SKIP_WHITE, 1);