Hello,
I need assistance on extracting the "Paragraph" elements using Linq to XML from the following XML code:
<?xml version='1.0' encoding='windows-1252' standalone='yes'?>
<Book BookID="-1"
xmlns="http://xyz.com/Book"
xmlns:xsi="http://www.w3.org/2001/XmlSchema-instance"
xsi:schemaLocation="http://xyz.com/Book AIMLXmlSchema.xsd">
<Paragraph NumberOfSentences='1'>
<Sentence>A Practical Logic of Cognitive Systems Volume 1
Agenda Relevance A Study in Formal Pragmatics
A Practical Logic of Cognitive Systems Volume 1
Agenda Relevance A Study in Formal Pragmatics
Dov M. Gabbay
Department of Computer Science King's College London London, UK
and
John Woods
The Abductive Systems Group University of British Columbia Vancouver BC, Canada
2003
ELSEVIER
Amsterdam Boston London New York Oxford Paris San Diego San Francisco Singapore Sydney Tokyo
ELSEVIER SCIENCE B.V.</Sentence>
<PageInfo>
<Type>Normal</Type>
<PageNumber>3</PageNumber>
<BegIdx>0</BegIdx>
<EndIdx>489</EndIdx>
<Location>Not Used</Location>
</PageInfo>
</Paragraph>
...
I tried this:
XElement doc = XElement.Load(strFilepath);
foreach (var item in doc.Descendants("Paragraph"))
{
System.Console.WriteLine("item found.");
}
but no items were returned.