XML Dom

DOM – Document Object Model is a language independent interface where each Node is an Object provides the data of the document in the XML tree structure.

The standard is maintained by W3C (Word Wild Web Consortium)

XML DOM provides the details to get, change, add & delete XML elements in a XML document.

[/crayon]

Output

In the above example we have used the HTML javascript DOM Parser to parse the Input XML and fetch the value simple by using the XML field/tag/element Name.

By the above simple example we can parse the XML DOM and identify the values in any languages.,

DOM usually loads the entire XML as a document into memory and forms XML tree structure.,
Hence to fetch any values for Nodes, we have to parse the Nodes in the tree and check the element and fetch the value.

There are different parsers, which will not load the entire document as DOM structure, instead it parses the XML structure as a string and identifies the value.,
Example, we have SAX Parsers, which traverse the XML as Strings.

E.g., SAX Parser implementation in Java., usually dont use much memory like DOM and its faster.,

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *