all groups > dotnet xml > march 2006 >
You're in the

dotnet xml

group:

2.0 : fastest read-only forward-only loading method


2.0 : fastest read-only forward-only loading method John A Grandy
3/28/2006 1:22:34 PM
dotnet xml:
In 2.0 what is the fastest way to iterate through an element set in a
read-only forward-only XMLDocument ?

For example , load the key/value pairs in the following xml doc into a
hashtable :

<Mappings>
<Mapping MappingKey="AL" MappingValue="Alabama" />
<Mapping MappingKey="CA" MappingValue="Alabama" />
</Mappings>


Re: 2.0 : fastest read-only forward-only loading method Martin Honnen
3/29/2006 12:00:00 AM


[quoted text, click to view]

Create an XmlReader and read out the nodes you are looking for. That
assumes you have an XML document in a file or stream. If you already
have a DOM XmlDocument instance then using XPath is an option.



--

Martin Honnen --- MVP XML
Re: 2.0 : fastest read-only forward-only loading method John A Grandy
4/19/2006 1:39:27 PM
Unless your xml schema is simplistic, I think an XPathReader is typically
necessary ... no ?

[quoted text, click to view]

Re: 2.0 : fastest read-only forward-only loading method Martin Honnen
4/20/2006 2:26:46 PM


[quoted text, click to view]

You asked the following:

[quoted text, click to view]

For read-only forward-only fastest reading an XmlReader is the tool.

--

Martin Honnen --- MVP XML
Re: 2.0 : fastest read-only forward-only loading method John A Grandy
4/21/2006 9:35:32 AM
Right, but what if the element set you wish to iterate through is buried in
a complex XML hierarchy ...

[quoted text, click to view]

Re: 2.0 : fastest read-only forward-only loading method Martin Honnen
4/21/2006 6:46:07 PM


[quoted text, click to view]

Well Xml(Text)Reader pulls in node by node so it is capable with dealing
with a complex XML hierarchy, you simply need to make sure your code
using the reader finds what it is looking for.
I don't think we will get far by discussing further without knowing the
XML markup you have in mind so feel free to post a URL for instance. Of
course you can use XPath if you want to, it is not that my suggestion
was meant to rule XPath out.


--

Martin Honnen --- MVP XML
AddThis Social Bookmark Button