jQuery in Action, 2nd edition*
The moose likes Product and Other Certifications and the fly likes Questions About DOM and 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 "Questions About DOM and SAX" Watch "Questions About DOM and SAX" New topic
Author

Questions About DOM and SAX

Himal Chuli
Ranch Hand

Joined: Aug 06, 2002
Posts: 118
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 ]

Himal
Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662
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".
Himal Chuli
Ranch Hand

Joined: Aug 06, 2002
Posts: 118
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
Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662
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.
ZEESHAN AZIZ
Ranch Hand

Joined: Jan 15, 2001
Posts: 162
Hi, Is Q 4 and 7 not very confusing than. It is not a case of black and white, I would say, shades of grey. And if they put up these sort of questions in exam, I am sure I will loose my 120�.
Hisham Ennarah
Greenhorn

Joined: Oct 23, 2002
Posts: 4
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Questions About DOM and SAX