• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help with practise questions.

 
Rajesh Parab
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, could anybody help me with following questions please?
Thx.
Rajesh
1. When using a SAX2 parser, a listener can do which of the following in order to get called back by the parser on events related to ALL types of XML Constructs?

a) Implement EntityResolver, DTDHandler, ContentHandler and ErrorHandler.

b) Implement DocumentHandler interface.

c) Implement ContentHandler interface.

d) Create a subclass of the DefaultHandler class.


2. If two DOM nodes are equivalent, which of the following are TRUE?
I. The DOM nodes have the same node type and node name.
II. The node data are the same.
III. The collection of attribute names are the same.

a) I and II only

b) I and III only

c) II and III only

d) I, II and III


3. An XPath expression returns "hello" in a text node when the expression is processed on an XML document. The XML document is well-formed and valid, but does not contain "hello". Which of the following BEST explains the situation?


b) The XSLT processor resolved the entity references.

c) An incorrect relative location path is specified with respect to the current context node.

d) There is a missing "/" at the end of the location path.

e) There is a missing "@" somewhere in the location path.
 
Nitin Gujral
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1 - d
DefaultHandler provides default implementations for all of the callbacks in the four core SAX2 handler classes.
2 - d
For two DOM nodes to be equivalent their collection of attribute names should be same, their data should be same and they should have same name and type
3 - b
 
Rajesh Parab
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot, Nitin. My overall feeling is that exam 141 is much demanding than it's predecessor.
All the best guys!
Cheers,
Rajesh.
 
Niharika Srivastav
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
the answer to Q1 is a and d.
Good Luck!
Niharika
 
Doug Wang
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nitin Gujral:
1 - d
DefaultHandler provides default implementations for all of the callbacks in the four core SAX2 handler classes.
a is also ok. There are 2 correct choices.
3 - b
Nitin, can you give some explanation for this choice? Thanks.

Doug
 
Nitin Gujral
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Doug,
For 3 as the statement is
The XML document is well-formed and valid, but does not contain "hello".
So whatever your XPath expression may be, it is not goiing to return you "hello". So, I think the only probable cause is the option 'b' i.e. the XSLT processor resolved the entity references one of which may contain "hello".
Your thoughts?
 
Doug Wang
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Nitin
Look at the following XPath expressions that all return "hello":
"hello" itself is a legal XPath expressions. or
concat("hel","lo")
x element (the expression may be constructed as //x) assumes the following XML fragment (there is only one x in the doc):
<x>h<y/>e<y/>l<y/>l<y/>o</x>
substring(comment(),1,5) assumes the following comment and it is the first comment:
<!-- hello world -->
...... many like
Do I go picky or I misunderstand the Q?
I am expecting your thoughts.

Doug :roll:
 
Nitin Gujral
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Doug,
Your examples are perfectly valid, but I think the other options except 'C' won't satisfy the conditions specified in the question.
Nitin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic