You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application. A
file named books.xml contains the following XML.
<bib>
<book title=”Programming in Unix” year=”1992″>
<author>Author1</author>
<author>Author2</author>
<author> Author 3 </out hor>
</book>
</bib>
The application must generate an XML result that contains an XML element named BookTitle for
each book. The text content of the element must contain the title of the book. You need to create a
query that generates the new XML result.
A.
Dim document As XDocument = XDocument. Load (“books.xml”)
Dim query = From node In document.Descendants()
Where node.Name.LocalName = “book”
Select New XElement(“BookTitle”, node.FirstAttribute.Value)
B.
Dim document As XDocument = XDocument.Load(“books.xml”)
Dim query = From node In document.DescendantNodes()
Where node.ToString()= “book”
Select New XText(“BookTitle” & node.ToString())
C.
Dim document As XDocument = XDocument.Load(“books.xml”)
Dim query = From node In document.Descendants()
Uhere node.Name.LocalName = “book”
Select New XElement(“BookTitle”).Value –
node.FirstAttribute.Value
D.
Dim document As XDocument = XDocument.Load(“books.xml”)
Dim query = From node In document.DescendantNodes()
Where node.ToString() = “book”
Select New XElement(“BookTitle”,
node.ToString())