xml_parser_get_option

(PHP 4, PHP 5, PHP 7, PHP 8)

xml_parser_get_optionLit les options d'un analyseur XML

Description

xml_parser_get_option(XMLParser $parser, int $option): string|int

Lit les options d'un analyseur XML.

Liste de paramètres

parser
Une référence sur un analyseur XML valide.
option
L'option demandée. XML_OPTION_CASE_FOLDING, XML_OPTION_SKIP_TAGSTART, XML_OPTION_SKIP_WHITE et XML_OPTION_TARGET_ENCODING sont disponibles. Reportez-vous à xml_parser_set_option() pour leurs descriptions.

Valeurs de retour

xml_parser_get_option() retourne false si parser n'est pas un analyseur valide ou si option n'est pas valide (génère aussi un E_WARNING). Sinon, elle retourne la valeur de l'option demandée.

Historique

Version Description
8.0.0 parser attend une instance de XMLParser désormais; auparavent, une resource était attendu.
7.1.24, 7.2.12, 7.3.0 options supporte désormais XML_OPTION_SKIP_TAGSTART et XML_OPTION_SKIP_WHITE.
add a note add a note

User Contributed Notes 1 note

up
0
dnricky at hotmail dot com
6 years ago
<?php
$xmlparser
= xml_parser_create();

echo
"XML_OPTION_CASE_FOLDING:" . xml_parser_get_option($xmlparser, XML_OPTION_CASE_FOLDING) . "<br />"; //Specifies if case-folding is enabled. Enabled by default. Can be 1 (TRUE) or 0 (FALSE)

echo "XML_OPTION_TARGET_ENCODING:" . xml_parser_get_option($xmlparser, XML_OPTION_TARGET_ENCODING ) . "<br />"; //Specifies 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.

xml_parser_free($xmlparser);
?>
To Top