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
SCJP2
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.
Thanks,<br />Vlad
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
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?
Don't get me started about those stupid light bulbs. |