GeeCON Prague 2014*
The moose likes Product and Other Certifications and the fly likes More questions. 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 "More questions." Watch "More questions." New topic
Author

More questions.

Vasudha Deepak
Ranch Hand

Joined: Mar 15, 2002
Posts: 86
1) For an application that makes use of XML, the input XML data set consists of many elements and is very large. The BEST way to filter or extract a subset of information from the complete XML document would be to:

a) Parse the input into a DOM tree and traverse the resulting tree.

b) Use SAX to extract the required elements.

c) Make use of an XSL style sheet.

d) Use the Scalable Vector Graphics (SVG) vocabulary.
I think SAX would be the right choice ie answer b)

2) A company wants to transmit parts of its sales order database to an outsourced service provider using XML. Which of the following is LEAST necessary?

a) Convert sales order database records into XML.

b) Validate the sales order XML before transmitting it to the service provider.

c) Use a DTD or XML Schema to describe the sales order data.

d) The service provider validates the XML sales order data after receiving it from the company

May be the correct answer is d).
Please Suggest.
Thanks,
Vasudha


IBM Certified Developer -XML and Related Technologies(141)<br />SCJP2 SCWCD
Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662
b) Use SAX to extract the required elements.
c) Make use of an XSL style sheet.
>>>>I think SAX would be the right choice ie answer b)
I agree with you here. I guess the xsl stylesheet processor uses again builds the whole XML DOM tree in order to carry out the transformation. Someone please explain me the whole process flow of how the xslt processor works. I have some rough (mis??)conception of this given below -
XML Instance Document -> SAX processor builds ->
DOM tree -> walk thru the tree to extract the
required nodes

a) Convert sales order database records into XML.
b) Validate the sales order XML before transmitting it to the service provider.
c) Use a DTD or XML Schema to describe the sales order data.
d) The service provider validates the XML sales order data after receiving it from the company

>>>>May be the correct answer is d).
I think the choice boils down b/w (b) and (d). I guess the client(service provider) would always validate an xml document after receiving it to make sure that he got valid stuff. Hence my choice for this would be "b" (least necessary thing).
Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662
A little addition.
2) A company wants to transmit parts of its sales order database to an outsourced service provider using XML. Which of the following is LEAST necessary?
I think if we look from the company's perspective (as in this question), "d" would be the least required thing. So you are absolutely right.
If we look at it from a neutral stand point, "b" would be the answer.
Vasudha Deepak
Ranch Hand

Joined: Mar 15, 2002
Posts: 86
Thanks for the explanations.
Vasudha
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
I think answer for the first question is not b). The keywords here are "filter or extract a subset of information from the complete XML document"
SAX does not have the ability to do this. SAX will not have the complete XML document available for you to filter or extract.
The answer is between DOM and XSLT. I think XSLT is a better choice since many tools are ready to use in xslt. In DOM, you need to code yourself to do the filtering and extraction.
[ September 25, 2002: Message edited by: Roseanne Zhang ]
Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662
I think i should agree with Zhang. If we look carefully at the question (cleverly framed !!!)
1) For an application that makes use of XML, the input XML data set consists of many elements and is very large. The BEST way to filter or extract a subset of information from the complete XML document would be to:
When i looked at the phrase "xml data set being very large", my sub-conscious took control and i started thinking about the memory consideration. But that is not mentioned here and i definitely feel that extracting the required info using SAX is pretty difficult when compared to any other approach.
I guess the approach of first applying a stylesheet (getting the required subset of info) and then parsing the result as a DOM is going to be more easy than trying to get the whole thing into a DOM (large document !!!) and then trying to parse it.
Hence i think the answer would be the XSLT approach.
Vasudha Deepak
Ranch Hand

Joined: Mar 15, 2002
Posts: 86
PXML2 says that the 3 main reasons for choosing SAX should be,
1)Large Document Handling
2)Retreiving a specific value from a document
3)Creating a subset document.
Filters can be used in SAX, to remove unwanted elements,modify elements or attributes.
So I am wondering if the best choice would be SAX?Similar question #29 on http://viktor99.virtualave.net/IBM141a.html,says that an event driven processing model should be used for extracting required elements.

Thanks,
Vasudha
Alfred Patino
Greenhorn

Joined: Sep 26, 2002
Posts: 3
hi
1. I think the correct answer is a) as the keywords are filter and extract so use DOM INstead of Sax
2. d) is the right choice
Aaron O'Brien
Ranch Hand

Joined: May 24, 2002
Posts: 89
If we look at this line:
The BEST way to filter or extract a subset of information from the complete XML document

The words that tip me off are filter or extract..and..from the complete XML document.
It leads me to think it would be answer c). Why go with DOM or SAX when it can be done with XSL? I would have to agree with Roseanne.


Aaron O'Brien
Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662
I too endorse this. SAX is the fastest way of walking down the tree, but definitely not the best way to "filter and extract" the required information. Had there been a mention of memory or speed concern, the answer would have been SAX. Also, there is no mention of changes to the content of the extracted info, which rules out the relevance of DOM. Hence we need only structural transformation of the input xml document and the easiest way to acheive this is using XSLT approach.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: More questions.