The document discusses the XML DOM (Document Object Model). It defines the DOM as a standard for accessing and manipulating XML documents through a tree structure representation. The DOM defines all elements in an XML document as nodes that can be traversed and modified. It outlines DOM properties and methods for navigating and manipulating the node tree. Advantages of the DOM include its traversable and modifiable tree structure, while disadvantages include higher resource usage compared to SAX parsing.
1. XML DOM
Prepared by: Pawan Dhawan
Software Engineer
Jan -30-2012
BOSS Webtech Private Limited
www.bosswebtech.com
2. Points we will covered
• What is XML DOM .
• Its structure.
• Its advantages and disadvantages
• Its uses.
3. WHAT IS DOM ?
• DOM is the Document Object Model.
• The DOM is a W3C (World Wide Web
Consortium) standard.
• The DOM defines a standard for accessing
documents like XML and HTML:
• DOM is memory-based, this making it
traversable and editable.
• DOM is not language-specific, nor is it
platform-specific.
4. What is the XML DOM?
The XML DOM is:
• A standard object model for XML
• A standard programming interface for XML
• Platform- and language-independent
• A W3C standard
5. DOM Nodes
According to the DOM, everything in an XML
document is a node.
The DOM says:
• The entire document is a document node
• Every XML element is an element node
• The text in the XML elements are text nodes
• Every attribute is an attribute node
• Comments are comment nodes
6. DOM Example
<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="web" cover="paperback">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>
8. XML DOM Properties
These are some typical DOM properties:
• x.nodeName - the name of x
• x.nodeValue - the value of x
• x.parentNode - the parent node of x
• x.childNodes - the child nodes of x
• x.attributes - the attributes nodes of x
Note: In the list above, x is a node object.
9. XML DOM Methods
• x.getElementsByTagName(name) - get all
elements with a specified tag name
• x.appendChild(node) - insert a child node to x
• x.removeChild(node) - remove a child node
from x
Note: In the list above, x is a node object.
13. Advantages of XML DOM
• XML structure is traversable.
Each node can be randomly accessed (one or
more times) by traversing the tree.
• XML structure is modifiable.
Since the XML structure is resident in memory,
values can be added, changed, and removed.
• The DOM standard is maintained by the World
Wide Web Consortium.
14. Disadvantages of XML DOM
• Resource intensive
Since the XML structure is resident in memory,
the larger the XML structure is, the more
memory it will consume.
• Relative speed
In comparison to SAX, DOM can be much
slower due to its resource usage/ needs.
15. Uses of XML DOM
• The XML DOM defines a standard way for
accessing and manipulating XML documents.
• The DOM presents an XML document as a
tree-structure.
• Knowing the XML DOM makes working easier
with XML.
17. About BOSS Webtech
o BOSS Webtech is a process oriented design house specializing in web design,
web development, backend web programming, mobile application
development and other web and mobile related design and support services.
o Recently launched BizPlus – Mobile based survey software. Check it more
here http://bizplusonline.com/
o More products here http://www.bosswebtech.com/products/products.html
Contact BOSS Webtech
o Call 831-998-9121 at US EST/CST/MST/PST Zone
or email info@bosswebtech.com