PrepAway - Latest Free Exam Questions & Answers

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?

PrepAway - Latest Free Exam Questions & Answers

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