Monday, 24 May 2010

PWS HW1 - DOM XML Parser

DOM parse the whole XML files to a tree structure where the root is the root of the XML file. Here you can find more info:


I this post you can find how I designed the structure of the DOM files:


For this method I have reused the example that it's in the web page of the course. The methods of XMLNodes are very useful.

After the builder parse the XML file, it creates a "Document". The first child of this document is the root of the XML file and the root of our tree.

Every XML element that is directly under the root (not nested) is the child of this root. You can use the method getNodeValue to ask for it and get the value.

For the XML elements that are not directly under the root (nested), you should create a new node and iterate inside this node asking for the required value.

No comments:

Post a Comment