English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

PHP Basic Tutorial

PHP Advanced Tutorial

PHP & MySQL

PHP Reference Manual

PHP xml_parser_set_option() Function Usage and Example

    PHP XML Functions Manual

    The xml_parser_set_option() function is used to set options for the XML parser.

Syntax

xml_parser_set_option(parser,option,value)

Definition and usage

It is used to set options in the XML parser

Return value

If the parser parameter does not point to a valid parser or the specified option cannot be set, the function will return FALSE, otherwise it will set the option to the specified value and return TRUE.

Parameter

Serial numberParameters and descriptions
1

parser

Required. Pointer to the XML parser whose option is to be set.

2

option

Required. Specify the option to be set. Possible values:
  • XML_OPTION_CASE_FOLDING - Specify whether to allow case-folding. The default is to allow. It can be 1(TRUE) or 0(FALSE).

  • XML_OPTION_SKIP_TAGSTART - Specify the number of characters to skip at the beginning of the tag name.

  • XML_OPTION_SKIP_WHITE - Specify whether to skip values composed of space characters. It can be 1(TRUE) or 0(FALSE).

  • XML_OPTION_TARGET_ENCODING - Specify which target encoding to use in the XML parser. By default, it is the same as the setting of the xml_parser_create() function, and it supports the following target encodings: ISO-8859-1、US-ASCII and UTF-8.

3

value

Required. Specify the new value of the option.

Online Example

Try the following example, which is the XML parser setting options.

<?php
   $input = xml_parser_create();
   
   xml_parser_set_option($input, XML_OPTION_SKIP_WHITE, 1);
   xml_parser_free($input);
?>
Teste e veja‹/›

PHP XML Functions Manual