Menu

XML Notes – Part 3 – JAX-P – DOM Parser

22/01/2015 - Application Programming Interface, XML

DOM Parser : Object based Parsing
==============================

Input XML (po.xml) represented in tree structure as follows :

purchaseOrder (root element)
|
|——> orderItems
|                 |
|                 |
|                 |——-> item
|                 |
|                 |
|                 |——-> itemCode
|                 |                 |
|                 |                 |
|                 |                 |———> IND007
|                 |
|                 |
|                 |——-> quantity
|                                   |
|                                   |
|                                   |———> 7
|
|
|——-> shippingAddress
|
|
|———-> addresssLine1
|                      |
|                      |—-> Customer007
|
|———-> addresssLine2
|                      |
|                      |—-> Jayanagar
|
|———-> city
|                  |
|                  |—-> Bangalore
|
|———-> state
|                  |
|                  |—–> Karnataka
|
|———-> pin
|                  |
|                  |—–> 560011
|
|———-> Country
|
|—–> India
XML Document –> Parser –> XML DOM Tree
—————————————————————-
                               JAX-P
—————————————————————-
                      Application Code

Image source : http://www.xml.com/2005/07/06/graphics/image003.jpg
Project 3 : Traverse between all the nodes recursively using DOM Parser:
https://github.com/nandakishorkn/jnj/tree/master/domparser/xmldomparsing/Project3

DOM Parser Example Project :
=============================
Reads the XML Document (i.e. po.xml) via DOM XML Parser.

PODOMParser.java :
================

 

 

po.xml :
=======

 

 

Nanda Kishor K N
Senior Member of Technical Staff at Oracle India Pvt. Ltd.
Co-Founder of JavaAndJava.com, A Webmaster, Java Enthusiast, Enterprise Portal Developer, Foodie, Traveller, SEO, SMO, WordPress Fan, Loves Photography, Veggie Lover, Ex-Sun Employee, Proud Dad, Bangalorean, An INDIAN.Passion for building stronger online communities and aiming to build a self-sustainable high traffic websites which is informative yet useful to as many people as possible.

Leave a Reply