File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Product and Other Certifications and the fly likes DOM OR SAX Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "DOM OR SAX" Watch "DOM OR SAX" New topic


Ranch Hand

Joined: Jan 15, 2001
Posts: 162
This question is Q. 4 of JAVA Ranch XML Mock exams (DOM AND SAX Questions) I had thought answer should be A, as memory is constrained. However given answer is b. Expert views please.

4. There is XML data document which is very large. The application is to extract the very few of its information from document. The memory & speed may be a constraint. Which is the most likely method to be implemented?
a) Extract the information using SAX API, event based methods.
b) To extract the information using DOM API.
c) To extract the necessary information and process using XSLT.
d) To use schema based approach
Similarly, in the same exam Q 7, I had thought C should have been the answer, because of memory constraint. However as per mock, answer is B. I would be obliged if anyone can explain.
7. Consider a system which is memory & speed constraint. The application is to process XML documents, sort the contents and mail them to a higher configuration machine for transformation. Which is the best approach?
a) Use platform native language to process the docuements
b) Use DOM based approach.
c) Using SAX based approach is the best.
d) DOM and SAX must be used in this context

[ July 03, 2002: Message edited by: ZEESHAN AZIZ ]
Ajith Kallambella

Joined: Mar 17, 2000
Posts: 5782
Point to remember- DOM is memory intensive. If you have memory constraints, you should reevaluate using DOM. DOM also offers flexibility in terms of random( non-sequential) processing.
I have emailed who happens to be the author of this mock exam to take a look at the answers he has given. Perhaps with each answer he can include a brief explanation.

Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Dan Chisham

Joined: Jun 03, 2002
Posts: 9
I agree with you on question 6. I'm fairly certain that SAX is the correct answer.
On question 7, there is more room for doubt because of the sorting requirement. In this case, the DOM might be a better choice. Actually, XSLT would probably be the tool of choice, and it would most likely use the DOM.
In general, when only a small subset of the data is required and when sequential processing is okay, SAX is the answer. When complex processing and random node visits are required, DOM is better.

IBM Certified Developer - XML and Related Technologies<br />CXE (Certified XML Expert)<br />Sun Certified Web Component Developer<br />Sun Certified Java 2 Programmer<p>Dan
I agree. Here's the link:
subject: DOM OR SAX
It's not a secret anymore!