I have a document that looks like the below. In the .NET 2.0 days, I
might use an XmlDomDocument to read the whole thing to see if it is a
basically good XML document. Then I might step through it with a
reader of some kind.
The entire XML document is now huge. Way too big to go into a DOM
document for parsing.
I was wondering if I could use LINQ for XML to query the "level_1"
parts to put each of them into something I can test, like a new
object.
Thanks.
<?xml version="1.0" encoding="UTF-8"?>
<Feed>
<level_1>
<url>http://www.aaaaaa.com</url>
<urlalt>http://www.aaaaa.net</urlalt>
<title>title from one</title>
<desc>descripti on from one</desc>
<richdata>
<![CDATA[
this is rich data from one
]]>
</richdata>
<subdata>
<subdata_a>
<title>sub-a</title>
<info>sub-a information</info>
</subdata_a>
</subdata>
</level_1>
<level_1>
<url>http://www.bbbbb.com</url>
<urlalt>http://www.bbbbb.net</urlalt>
<title>title from two</title>
<desc>descripti on from two</desc>
<richdata>
<![CDATA[
this is rich data from two
]]>
</richdata>
<subdata>
<subdata_a>
<title>sub-b</title>
<info>sub-b information</info>
</subdata_a>
</subdata>
</level_1>
</Feed>
might use an XmlDomDocument to read the whole thing to see if it is a
basically good XML document. Then I might step through it with a
reader of some kind.
The entire XML document is now huge. Way too big to go into a DOM
document for parsing.
I was wondering if I could use LINQ for XML to query the "level_1"
parts to put each of them into something I can test, like a new
object.
Thanks.
<?xml version="1.0" encoding="UTF-8"?>
<Feed>
<level_1>
<url>http://www.aaaaaa.com</url>
<urlalt>http://www.aaaaa.net</urlalt>
<title>title from one</title>
<desc>descripti on from one</desc>
<richdata>
<![CDATA[
this is rich data from one
]]>
</richdata>
<subdata>
<subdata_a>
<title>sub-a</title>
<info>sub-a information</info>
</subdata_a>
</subdata>
</level_1>
<level_1>
<url>http://www.bbbbb.com</url>
<urlalt>http://www.bbbbb.net</urlalt>
<title>title from two</title>
<desc>descripti on from two</desc>
<richdata>
<![CDATA[
this is rich data from two
]]>
</richdata>
<subdata>
<subdata_a>
<title>sub-b</title>
<info>sub-b information</info>
</subdata_a>
</subdata>
</level_1>
</Feed>
Comment