You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application. A
file named books.xmi contains ths following XML.
<bib>
<book title3″Ercgranraing in Unix” yeai=”1992*,>
<author> Author1</author >
<author>Author2</author>
<author>Author3</author>
</book>
</bib>
The application must generate an XML result that contains an XML element named DookTitle for
each book. The text content of must contain the title of the book. You need to create a query that
generates the new XML result. Which code segment should you use?
A.
XDocument document = XDocument.Lcad(“books.xml”) ;
var query = from node in document.Descendants()
where node.Name.LocalName == “book”
select new XElement (“BookTitle”,
node.FirstAttrlbute.Value);
B.
XDocument document = XDocument.Lead(“books.xml”) ;
var query = from node in document.DescendantNodes()
where node.ToString() == “book”
select new XElement(“BookTitle”, node.ToString()) ;
C.
XDocument document = XDocument.Load(“books.xml”) ;
var query = from node in document.Descendants()
where node.Name.LocalName = “book”
select new XElement(“BookTitle”).Value =
node.FlrstAttrlbute.Value;
D.
XDocument document = XDocument.Load(“books.xml”) ;
var query = from node in document.DescendantNodes()
where node.ToStrmg () == “book”
select new XText(“BookTitle” + node.ToString());