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.
When a Sax parser parses a XML document and every time it encounters a tag it calls the corresponding tag handler methods when it encounter a Start Tag it calls this method public void start Element(String name, Attribute List attrs) when it encounter a End Tag it calls this method public void end Element(String name) This program also parses a XML file and prints it on the console . In this example, the Print Using Sax Class extends the Handler Base class and implemets the call back methods to handle the printing The steps involved are Get a instance of SAX parser, The previous program illustrated how to Parse an existing XML file using both SAX and DOM Parsers.This will help you to get the basic concepts in parsing and how does DOM API differ from SAX.6.1.1 Using DOM parses a XML file and prints it on the console . This is a two stage process, first it parses the XML file and creates a tree structure in the memory.In this page, we start a new PHP session and set some session variables: Next, we create another page called "demo_session2.php".From this page, we will access the session information we set on the first page ("demo_session1.php").The previous errata for this document, are also available. This document is also available in these non-normative formats: XML and XHTML with color-coded revision indicators.