tags:

views:

23

answers:

3

Hi Folks,

I know that when using LinQ it is possible to have an element that is not attached to any root document, but is it possible to take that one step further and have xml data that has no root element; essentially a collection of XElements?

xml:

<XElement1>
   <someData>data</someData>
</Xelement1>
<XElement2>
   <someData>data</someData>
</Xelement2>
<XElement3>
   <someData>data</someData>
</Xelement3>
...
...

Thnx.

+1  A: 
<XElements>
 //elements
</XElements>

Root is # necessary

nilphilus
A: 

You can use XmlTextReader or XmlValidatingReader to read xml fragments:

http://msdn.microsoft.com/en-us/library/cakk7ha0(v=VS.100).aspx

http://msdn.microsoft.com/en-us/library/k4yze3k7.aspx

mamoo
This looks just the ticket, cheers.
baileyswalk
A: 

If you're not interested in storing it in a file, then just use List. If you do need to store it in a file then the links about reading XML fragments mentioned above by mamoo are what you're looking for.

Vitek Karas MSFT