Re: How to read XML file without "Root" Node
- From: Martin Honnen <mahotrash@xxxxxxxx>
- Date: Wed, 10 Sep 2008 13:38:10 +0200
Tom Chang wrote:
Try to read following type of XML file, but only get data back on first
node:
<log id="1234">
<message type="Action"/>
</log>
<log id="5678">
<message type="Drama"/>
</log>
<log id="1357">
<message type="Art"/>
</log>
If you have .NET 2.0 or later then use
Dim set as New XmlReaderSettings()
set.ConformanceLevel = ConformanceLevel.Fragment
Using reader As XmlReader = XmlReader.Create("test.log", set)
While reader.Read()
'read out properties here
End While
End Using
See http://msdn.microsoft.com/en-us/library/system.xml.xmlreadersettings.conformancelevel.aspx
That way you can process fragments of XML that don't have a root element.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
.
- Follow-Ups:
- Re: How to read XML file without "Root" Node
- From: Tom Chang
- Re: How to read XML file without "Root" Node
- References:
- How to read XML file without "Root" Node
- From: Tom Chang
- How to read XML file without "Root" Node
- Prev by Date: How to read XML file without "Root" Node
- Next by Date: Re: How to read XML file without "Root" Node
- Previous by thread: How to read XML file without "Root" Node
- Next by thread: Re: How to read XML file without "Root" Node
- Index(es):