Change language

PHP Xml_parser_create_ns () function

Syntax:
resource xml_parser_create_ns (string $encoding, string $separator )
Parameters:This function takes two parameters as above and described below:
  • $encoding:this is an optional parameter. Defines the character encoding
    • for input / output in PHP 4
    • for output from PHP 5 only
    • for 5.0.0 and 5.0.1 the default output encoding is ISO -8859-1
    • from 5.0.2 the default is UTF-8 encoding
    Possible $encoding values: ISO-8859-1, UTF-8 and US- ASCII.
  • $separator:This is an optional parameter. It defines the output delimiter for the tag name and namespace. Default value: ":".
Returned value:
  • On success:returns a handle to a resource to be used by some other XML functions.
  • On Failure:returns FALSE.
Notes:
  • This feature is available for PHP 4.0.5 and above.
  • These examples may not work in the online IDE. So, try running it on your local server or on the php hosts.
Below programs illustrate the xml_parser_create_ns() function in PHP:Program 1:   // Create XML parser with
// namespace support $parser = xml_parser_create_ns();  
// Free the xml parser xml_parser_free ( $parser );  
?>
Output:
(no output)
Program 2:  
// Create an XML parser
// with namespace support $parser = xml_parser_create_ns();  
// Free the xml parser $res = xml_parser_free ( $parser );  
// Check if the parser has been created or not if (! $parser ) { echo "error occured!" ; } else { echo "parser with namespace support has successfully been created " ; }
?>
Output:
parser with namespace support has successfully been created
Link: https://www.php.net/manual/en/function.xml-parser-create-ns.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