1,703 views
1 1 vote

Consider the XML document fragment given below:

<Book>
<Title>GATE 2K7 Example<Title>
<Content>
             One of many lines 
</Content>
<TOC>
One of many content entries
</TOC>
</Book>


Consider the XPath expression: *[not (self ) : : TOC]
What would be the result of the given XPath expression when the current node is Book?

  1. The Title and Content elements
  2. The Content and TOC elements
  3. The Title and TOC elements
  4. The Title, Content and TOC elements

1 Answer

1 1 vote
Ans A)

XPath can be used to navigate through elements and attributes in an XML document.

I think *[not(self)::TOC] is not syntactically correct so we might get a syntax error.

It should be *[not(self::TOC)] instead which would select all child elements of the Book element that are not TOC elements so the Title element and the Content element will be selected.
• edited by
Answer:
Position:
Show:

Related questions

1 1 vote
2 2 answers
4.0k
4.0k views
Ishrat Jahan asked Oct 30, 2014
3,955 views
Consider a token ring topology with N stations (numbered 1 to N) running token ring protocol where the stations are equally spaced. When a station gets the token it is al...
3 3 votes
2 answers 2 answers
5.3k
5.3k views
Ishrat Jahan asked Oct 30, 2014
5,308 views
Consider a token ring topology with N stations (numbered 1 to N) running token ring protocol where the stations are equally spaced. When a station gets the token it is al...
28 28 votes
3 answers 3 answers
17.5k
17.5k views
Ishrat Jahan asked Oct 30, 2014
17,493 views
You are given the following four bytes : $$\begin{array}{| c | c | c | c |} \hline 10100011 & 00110111 & 11101001 & 10101011 \\\hline \end{array}$$ Which of the fol...
39 39 votes
7 7 answers
29.0k
29.0k views
Ishrat Jahan asked Oct 30, 2014
28,980 views
In the waveform (a) given below, a bit stream is encoded by Manchester encoding scheme. The same bit stream is encoded in a different coding scheme in wave form (b). The ...