PHP | xml_parser_create_ns() Function Last Updated : 05 Jan, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report The xml_parser_create_ns() function is an inbuilt function in PHP which is used to create an XML parser with namespace support and returns the resource handle. Syntax: resource xml_parser_create_ns( string $encoding, string $separator ) Parameters: This function accepts two parameters as mentioned above and described below: $encoding: It is optional parameter. It specifies character encoding for input/output in PHP 4only for output from PHP 5for 5.0.0 and 5.0.1 default output charset is ISO-8859-1from 5.0.2 default output charset is UTF-8$separator: It is optional parameter. It specifies the output separator for tag name and namespace. Its default value is " : ". Return Value: On Success: It returns a resource handle which is to be used by some other XML functions.On Failure: It returns FALSE. Note: This function is available for PHP 4.0.5 and newer version.These examples may not work on online IDE. So, try to run it on local server or php hosted servers. Below programs illustrate the xml_parser_create_ns() function in PHP: Program 1: PHP <?php // Create an XML parser with // namespace support $parser = xml_parser_create_ns(); // Free the xml parser xml_parser_free($parser); ?> Output: (no output) Program 2: PHP <?php // Creating an XML parser // with namespace support $parser = xml_parser_create_ns(); // Free the xml parser $res = xml_parser_free($parser); // Check parser is created or not if(!$parser) { echo "error occurred!"; }else { echo "parser with namespace support has successfully been created"; } ?> Output: parser with namespace support has successfully been created Reference: https://www.php.net/manual/en/function.xml-parser-create-ns.php Comment More infoAdvertise with us Next Article PHP | xml_parser_create_ns() Function G gekcho Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | xml_parser_create() Function The xml_parser_create() function is an inbuilt function in PHP which is used to create an XML parser. Syntax:Â resource xml_parser_create( string $encoding ) Parameters: This function accepts single parameter $encoding which is optional. It specifies the character encoding:Â Â for input/output in PHP 3 min read PHP | xml_parser_free() Function Pre-requisite: XML BasicsThe xml_parser_free() function is an inbuilt function in PHP which is used to free the XML parser. Syntax:Â Â bool xml_parser_free( resource $parser ) Parameters: This function accepts single parameter $parser which is required. It specifies the reference of XML parser to fre 3 min read PHP | xml_parse() Function The xml_parse() function is an inbuilt function in PHP which is used to parse XML document. Syntax:Â int xml_parse( resource $xml_parser, string $xml_data, bool $is_final ) Parameter: This function accepts three parameters as mentioned above and described below:Â Â $xml_parser: It is required paramet 3 min read PHP | xml_parser_get_option() Function Pre-requisite: XML Basics The xml_parser_get_option() function is an inbuilt function in PHP which retrieves the options from an XML parser. Syntax: mixed xml_parser_get_option( resource $parser, int $specified_option ) Parameters: This function accepts two parameters as mentioned above and describe 2 min read PHP | xml_parser_set_option() Function Pre-requisite: XML Basics The xml_parser_set_option() function is an inbuilt function in PHP which is used to set the options in an XML parser. Syntax: bool xml_parser_set_option( resource $parser, int $specified_option, mixed $option_value) Parameters: This function accepts three parameters as ment 2 min read Like