Change language

PHP Simplexml_import_dom () function

Syntax:
SimpleXMLElement simplexml_import_dom ($node, $class_name = "SimpleXMLElement")
Parameters :This function takes two parameters as above and described below:
  • $node:This parameter contains a DOM element node.
  • $class_name:is an optional parameter that contains the name of the class. If this parameter is used, then the simplexml_import_dom() function returns an object of the specified class. The class should extend the SimpleXMLElement class.
Return value:This function returns SimpleXMLElement on success or FALSE on error.The program below illustrates simplexml_import_dom() function in PHP:Program :  
// Create a DOMDocument instance $dom = new DOMDocument;  
// Load XML document $dom -> loadXML (’< organization > < name > GeeksforGeeks < / name >
Noida India
< contact > < email > [email protected]< / email > < mobile > + 91-987654321 < / mobile > < / contact > < / organization > ’);  
// Use the simplexml_import_dom() function to get
// SimpleXMLElement object from DOM node $doc = simplexml_import_dom ( $dom );  
// Show XML document content var_dump ( $doc -> contact [0] -> email ); var_dump ( $doc -> contact [0] -> mobile);  
?>
Exit:
object (SimpleXMLElement ) # 3 (1) {[0] = > string (21) "[email protected]"} object (SimpleXMLElement) # 3 (1) {[0] = > string (13) "+ 91-987654321"}
Link: https://www.php.net/manual/en/function.simplexml-import-dom.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