0% found this document useful (0 votes)
19 views

Lab 7

Tooba Aamir submitted an engineering lab report for her course "Engineering for Internet Applications" at the University of Melbourne in October 2011. The report includes a link to her servlet and explains the difference between a SAX parser and a DOM parser. SAX parses nodes one by one without storing the entire XML in memory, while DOM loads the full XML file into memory before processing, allowing traversal in any direction but using more memory.

Uploaded by

Tooba Aamir
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Lab 7

Tooba Aamir submitted an engineering lab report for her course "Engineering for Internet Applications" at the University of Melbourne in October 2011. The report includes a link to her servlet and explains the difference between a SAX parser and a DOM parser. SAX parses nodes one by one without storing the entire XML in memory, while DOM loads the full XML file into memory before processing, allowing traversal in any direction but using more memory.

Uploaded by

Tooba Aamir
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Engineering for Internet Applications Lab 7 Tooba Aamir - 396447

University of Melbourne (Semester-2 2011) Department of Computer Science and Software Engineering

Course title Engineering for Internet Applications

Submitted by: Tooba Aamir 396447

Dated October, 7 2011

Engineering for Internet Applications Lab 7 Tooba Aamir - 396447


1. Include a link to your servlet in your report.

http://s620-37.csse.unimelb.edu.au:8080/Lab7/fetch.html 2. Explain in your report what is difference between SAX parser and DOM
parser?

Parsers are helper programs or libraries to do low level parsing in application from scratch. This low-level parsing ensure that document is well-formed and valid against its DTD or schema and also resolves character reference etc. Two common types of parser used are SAX and DOM and both work in different ways. DOM Parser i.e. Document Object Model Parser, loads the entire XML file into the primary memory before processing resulting in more memory occupation no matter how much is actually needed by the client. DOM represents document in a Tree structured manner thats why also called tree model parser. It can traverse in any direction and we can insert or delete nodes using DOM. Header files for DOM are 'javax.xml.parsers' and 'org.w3c.dom'. In comparison to this SAX i.e. Simple API for XML parses node by node and doesnt store the XML in memory and serves the client application always only with pieces of the document at any given time. Also traversing in SAX is always top to bottom with limitation of no insertion or deletion of nodes. SAX is an event based parser i.e. it works incrementally and generates events that are passed to the application, these event generations result in methods invocation called 'callback'. Header files for SAX includes 'javax.xml.parsers', 'org.xml.sax' and 'org.xml.sax.helpers'. SAX runs bit faster than DOM.

You might also like