XML DOM Tutorial

W3C provides a standard called DOM for HTML & XML documents.

XML DOM Tutorial

     

W3C provides a standard called DOM (Document Object Model) for HTML & XML documents. DOM is also used as an interface for accessing and manipulating HTML & XML documents.DOM is a convention for representing and interacting with HTML, XML document objects, it is platform and language independent.

In the example below we create an object called $xml of DOMDocument class, and we access load() and saveXML() functions of it. 

Example

phpDom.php

<?php

$xml=new DOMDocument();

$xml->load("MyFirst.xml");

print $xml->saveXML();

?>

MyFirst.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>
<lang>
<php>
PHP is very easy to learn
</php>
<Java>
Java is the king of open source language
</Java>
</lang>

Output:

PHP is very easy to learn Java is the king of open source language

Advertisements

Ads

 

We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.

Share on Google+Share on Google+

XML DOM Tutorial

Posted on: November 21, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: XML DOM Tutorial  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads