aspose file tools*
The moose likes Product and Other Certifications and the fly likes Questions on DOM/SAX test from XML Exam List Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "Questions on DOM/SAX test from XML Exam List" Watch "Questions on DOM/SAX test from XML Exam List" New topic
Author

Questions on DOM/SAX test from XML Exam List

Brooklyn Luo
Greenhorn

Joined: Jun 28, 2001
Posts: 6
I have 2 questions regarding DOM/SAX test from Java Ranch's XML Exam List.
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.
Answer:b
Can someone tell me why a is not correct?
11. Use of SAX based parser is most likely to be used in which of the following scenarios?
a) You want to process the document in a sequential order only.
b) The documents is very large.
c) When there is no need to validate XML documents.
d) The parser implements only SAX based approach.
Answer:a
I think b is also OK.

Thanks
Amit Ganatra
Greenhorn

Joined: Jun 19, 2001
Posts: 19

Hi,
I think, the answer for the fist question should be SAX parser, because question specificaly mentinons, Memory may be a constraint and DOM parsers are heavy on memory when XML documents are very large.
As u know, the DOM parser builds the DOM tree (in memory) for the entire XML document before parsing it. Hence for a large XML document performance of the application would be hit badly if a DOM parser is used.
For 2nd question a seems to be an approporiate choice because it mentions that document is to be processed sequentially and only SAX parsers have this feature.
Hope this helps,
amit
Originally posted by Brooklyn Luo:
I have 2 questions regarding DOM/SAX test from Java Ranch's XML Exam List.
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.
Answer:b
Can someone tell me why a is not correct?
11. Use of SAX based parser is most likely to be used in which of the following scenarios?
a) You want to process the document in a sequential order only.
b) The documents is very large.
c) When there is no need to validate XML documents.
d) The parser implements only SAX based approach.
Answer:a
I think b is also OK.

Thanks


------------------
Sun Certified Java Programmer for Java 2 Programming


SCJP2
Scott Collens
Greenhorn

Joined: Jun 21, 2001
Posts: 20
For question 1:
I believe 'a' is not correct because, although it is true that SAX offers better performance than DOM with large documents, 'b' is MORE likely to be used because SAX forces you to read the document sequentially whereas DOM allows you to navigate to a portion of the document and manipulate the data in place. This satisfies the requirement of extracting very few of the information from the document in a timely manner. If you were outputting the entire document, SAX would be more efficient, and thus 'a' would be correct.
Question 2:
Again both are correct, but we need to answer which is MORE likely. Although it is true that the efficiency of processing large documents is greater with SAX than DOM, the fact that the document MUST be processed sequentially suggest that the only logical choice can be SAX.
Vlad Patryshev
Ranch Hand

Joined: Jun 30, 2001
Posts: 61
Originally posted by Scott Collens:
For question 1:
I believe 'a' is not correct because, although it is true that SAX offers better performance than DOM with large documents, 'b' is MORE likely to be used because SAX forces you to read the document sequentially whereas DOM allows you to navigate to a portion of the document and manipulate the data in place. This satisfies the requirement of extracting very few of the information from the document in a timely manner. If you were outputting the entire document, SAX would be more efficient, and thus 'a' would be correct.

Regarding input: what kind of magic in your opinion makes it possible for DOM just to skip pieces the input file up to the right position where relevant data can be found, as opposed to SAX which reads the same characters and passes them to handlers which in turn are free to skip thiem?
Regarding output: does SAX has anything to do with document output?

Thanks,<br />Vlad
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
It is evident from the discusion that the cause of confusion is the ambiguous sentences used to frame the questions. Can someone email the author( his address can be found on top of the mock exam page ) and findout the intent? Perhaps he can reframe the question if he feels all of us have misunderstood the original intent.
Thanks!


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Scott Collens
Greenhorn

Joined: Jun 21, 2001
Posts: 20
Originally posted by Vlad Patryshev:
Regarding input: what kind of magic in your opinion makes it possible for DOM just to skip pieces the input file up to the right position where relevant data can be found, as opposed to SAX which reads the same characters and passes them to handlers which in turn are free to skip thiem?
Regarding output: does SAX has anything to do with document output?

My apologies. I was considering that one may want to update the info., rather than just extract it. I tend to agree with Brooklyn. SAX appears to be the the correct solution.
Regarding output. Once again, I apologize for my poor choice of words. If some one has contacted the author of the test, can you kindly post the response.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Questions on DOM/SAX test from XML Exam List
 
Similar Threads
DOM OR SAX
Questions About DOM and SAX
Question ?
correct answer
Errors in DOM/SAX Mock exams ???