xml parser set option in PHP
In this article I will explain how the xml_parser_set_option() function can be used in PHP.
xml_parser_set_option() function in PHP
- The xml_parser_set_option() function is used to set options from an XML parser.
- The xml_parser_set_option() function returns the options value on success.
- The xml_parser_set_option() function returns FALSE and an error on failure.
Syntax
xml_parser_set_option(parser,option,value) |
Parameter
- parser parser is required parameter. it is specify for XML parser to use.
-
option option is required parameter. it is specify for option to set. Possible values:
- XML_OPTION_CASE_FOLDING - It is specify if case-folding is enabled. it is enabled by default. It can be 1 for TRUE or 0 for FALSE.
- XML_OPTION_SKIP_TAGSTART - It is specify how many characters should be skipped in the beginning of a tag name
- XML_OPTION_SKIP_WHITE - It is specify whether to skip values consisting of white-space characters. It can be 1 for TRUE or 0 for FALSE.
- XML_OPTION_TARGET_ENCODING - It is specify which target encoding to use in this XML parser. this is the default value, it is set to the same as the xml_parser_create() function.
- value value is required parameter. it is the option for new value.
Example
The following example show to how the xml_parser_set_option() function can be used in PHP.
<html>
<body>
<h3 style="color: darkgreen;">xml_parser_set_option() function example in PHP</h3>
<?php
$xmlparser = xml_parser_create();
echo"xml_parser is created with xml_parser_create<br/>";
echo "Return value by set option is : ".xml_parser_set_option($xmlparser, XML_OPTION_SKIP_WHITE, 1);
xml_parser_free($xmlparser);
echo("<br>Now xml_parser free with xml_parser_free function....!");
?>
</body>
</html>
|
Output
You may also want to read these related articles here
Ask Your Question
Got a programming related question? You may want to post your question here