hi folks, the following questions are from DOM/SAX (by Kris.VidhyaSagar) mock exam and i am not sure about the answer he provided. could anyone confirm it? 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.
Since the document is large and memory is constraint, i think the correct answer would be (a). Also, option (c) seems to be correct one to me. BUT his is (b). why? 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.
Since the resource is constraints, i think the answer would be (c). but his answer is (b). why? 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. my answers are (a) and (b) BUT his is just (a). why not (b) too? could someone clearify me this with some explanation please? i appreciate. thanks. himal [ October 21, 2002: Message edited by: Himal Chuli ] [ October 21, 2002: Message edited by: Himal Chuli ]
4) I guess the key there is memory "may be" a constraint, but not "is" a constraint. Hence the thumb rule what i developed is whenever it is not definitely stated that memory is a constraint, go for DOM :-) 7) "sort the contents" is the key here and the only way you can do that is using DOM 11) a) You want to process the document in a sequential order only. (this can be done only by SAX) b) The documents is very large. (this can be done even with DOM provided we have abundant resources) Hence the answer would be "a".
posted 17 years ago
great explanation jayadev, but can't XSLT or SAX do sorting things in the case of (7)? please give me a bit of explanation. by the way i am taking test this week. himal
posted 17 years ago
I think there is nothing like Sorting in SAX. When it comes to XSL, its kind of very limited using the <xsl:sort> element. I guess sorting in this context means to rearrange the nodes kind of stuff and that can be achieved easily by DOM.
Hi,I still find que 7 really confusing . I mean there isn't a certian method in DOM which automatically sorts elements. You would need to write some code to do the job , of course using SAX it would be much harder but you would be saving memory which is a constaint in the que.
If I'd had more time, I would have written a shorter letter. -T.S. Eliot such a short, tiny ad:
ScroogeXHTML 8.7 - RTF to HTML5 and XHTML converter