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 Function 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, this function will return FALSE, otherwise it will set the option to the specified value and return TRUE.

Parameter

Serial NumberParameters and Description
1

parser

Required. A 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 the value 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 examples, which are XML parser setting options.

<?php
   $input = xml_parser_create();
   
   xml_parser_set_option($input, XML_OPTION_SKIP_WHITE, 1);
   xml_parser_free($input);
?>
Test and see‹/›

PHP XML Function Manual