Which code segment should you use?

You load an XmlDocument named doc with the following XML.

<bookstore>
<books>
<book>
<title>World Atlas</title>
/book>
<book>
<title>Dictionary</title>
</book>
</books>
</bookstore>

You need to use an XPath query string to select the two book nodes. Which code segment should you use?

You load an XmlDocument named doc with the following XML.

<bookstore>
<books>
<book>
<title>World Atlas</title>
/book>
<book>
<title>Dictionary</title>
</book>
</books>
</bookstore>

You need to use an XPath query string to select the two book nodes. Which code segment should you use?

A.
XmlElement root=doc.DocumentElement;XmlNodelListnodes= root.SelectNodes(".");

B.
XmlElement root=doc.DocumentElement;XmlNodelListnodes= root.SelectNodes("book");

C.
XmlElement root=doc.DocumentElement;XmlNodelListnodes= root.SelectNodes("bookstore//book");

D.
XmlElement root=doc.DocumentElement;XmlNodelListnodes= root.SelectNodes("books/book");



Leave a Reply 0

Your email address will not be published. Required fields are marked *