The steps involved are a) Get an instance of DOM parser b) Create a new Document c) Load the Data d) Create a DOM tree with this Data e) Print the DOM tree which will be the XML file In detail a) Get an instance of DOM psrser to the same directory where you have downloaded these programs.
Please refer to the errata for this document, which may include some normative corrections.
If you are not using a structured editor that can enforce the markup as you type, validation with an external parser is a particularly important step in the document creation process.
a) Construction of DOM tree b) Traversing the DOM tree It does a Depth First Pre Order Traversal , for more on tree traversal techniques see here As it goes through each node it prints it contents.
Leaving out an end tag is a lot like an out of context start tag. The problem is never caused by the missing end tag per se, rather it's caused by the fact that something following it is now out of context.
The parser only tries to add additional elements, rather than rename elements that it's already seen.
But generating a XML file from scratch is a different story , for instance you might like to generate a xml file for the data extracted form the database.
To keep the example simple this program generates a XML file from a Vector preloaded with hard coded data.