Change language

PHP Xml_parser_get_option () function

Function xml_parser_get_option()- is a built-in PHP function that extracts parameters from an XML parser.Syntax:
mixed xml_parser_get_option (resource $parser, int $specified_option)
Parameters:This function takes two parameters as above and described below:
  • $parser:Required parameter. It defines the XML parser for which parameters are to be retrieved.
  • $selected_option:Required parameter (integer). It defines the parameters to be obtained from the specified analyzer. 
    Possible parameter values:
    • XML_OPTION_CASE_FOLDING:used to specify foldingcase. If enabled, it returns 1, and if disabled, it returns 0.
    • XML_OPTION_TARGET_ENCODING:is used to specify the target encoding in the specified XML parser. Returns the encoding name (US-ASCII, UTF-8 or ISO-8859-1, etc.)
    • XML_OPTION_SKIP_TAGSTART:is used to specify the number of characters missing at the beginning of the name tag.
    • XML_OPTION_SKIP_WHITE:is used to specify whether values ​​consisting of whitespace are skipped or not. Returns 1 if omitted, 0 otherwise.
Return value:This function returns the value of the specified parameter on success or False on error.Notes :
  • This feature is available for PHP 4.0.0 and newer.
  • The XML_OPTION_SKIP_TAGSTART and XML_OPTION_SKIP_WHITE options will only work for PHP 7.1.0 and later.
Program 1:

 
// Create an XML parser $parser = xml_parser_create(); echo " This example illustrates how xml_parser_get_option() " . "function works
"
; echo "XML_OPTION_CASE_FOLDING:" . xml_parser_get_option ( $parser , XML_OPTION_CASE_FOLDING ). "
"
;  
// Free XML parser xml_parser_free ( $parser );  
?>
Output:
This example show how xml_parser_get_option() function works XML_OPTION_CASE_FOLDING: 1
Program 2:  
// Create XML parser $parser = xml_parser_create();  
// Get options for all possible options echo "option = XML_OPTION_CASE_FOLDING:" . xml_parser_get_option ( $parser , XML_OPTION_CASE_FOLDING). "
"
; echo " option = XML_OPTION_TARGET_ENCODING: " . xml_parser_get_option ( $parser , XML_OPTION_TARGET_ENCODING). "
"
; echo " option = XML_OPTION_SKIP_TAGSTART: " . xml_parser_get_option ( $parser , XML_OPTION_SKIP_TAGSTART). "
"
; echo " option = XML_OPTION_SKIP_WHITE: " . xml_parser_get_option ( $parser , XML_OPTION_SKIP_WHITE);  
// Free XML parser xml_parser_free ( $parser );  
?>
Output:
option = XML_OPTION_CASE_FOLDING: 1 option = XML_OPTION_TARGET_ENCODING: UTF-8 option = XML_OPTION_SKIP_TAGSTART: 0 option = XML_OPTION_SKIP_WHITE: 0
Link: https://www.php.net/manual/en/function.xml-parser-get- option.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method