I have a question on XML Design questions(mock exam by Ajith Kallambella) question (4): Which of the following should NOT be relied upon to locate information of interest when querying the inventory listing XML documents? 1 The element type of an element. 2 An attribute value specified on an element start tag. 3 A processing instruction contained by the element of interest 4 Comments on the element declaration for the element of interest The answer is 3 and 4, but according to IBM Test 140 Sample Test question 27: 27. Which of the following should NOT be relied upon to locate information of interest when querying an XML document? 1, The element type of an element 2, An attribute value specified on an element start tag 3, A processing instruction contained by the element of interest 4, Comments on the element declaration for the element of interest the answer is 4. these two questions are almost same. can anybody tell me which answer is right? thanks for help, tom gong
We both agree why (4) is right. The issue is really about (3). Processing instructions( a.k.a. PI ) are special directives meant to serve as a channel of communication between the XML document and the application processing the XML. A classic example is the <?xml declaration at the top of the document containing information about the version, the encoding type, the reference to schema doc etc. Quote from the The annotated XML Specification -
In the real world, it is often very useful to post a yellow-sticky on a document saying "this is where the background music comes in" or "last time they edited, this was at the top of the screen", or the like. Processing Instructions (usually called PIs) are the solution. They are in the document, but are not part of the data
Even the W3C XML specification advices that the PI is not meant for, and should not be used for representing any content-related information. Hope that clarifies your doubt.
------------------ Ajith Kallambella M. Sun Certified Programmer for the Java�2 Platform. IBM Certified Developer - XML and Related Technologies, V1.
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Joined: Jul 15, 2000
Thanks Ajith. Your help is very appreciated, Tom Gong