No offense, but your XML document doesn't sound all that large. If the XML
file is less than 1MB in size, just use an XmlDocument and pull your data
out as you need it using XPath. If you haven't worked with it before, XPath
is a pretty decent query language that returns multiple nodes from anywhere
in the document. This is just about the most powerful method of getting
things out of an XML document available, if the document isn't too big to
fit in memory neatly as an XmlDocument.
If the document is big - you'll have to decide what "big" means - you can
use XmlReader, but the programming will be a lot more difficult. XmlReader
is a one-pass reader. There is no backtracking, no hierarchy, no state
(other than the state managed by the code you write). You'll have to pull
out the information you need as you parse and store it in a convenient
format. If the document is 10MB or bigger, you'll probably have to do
things the hard way.
If you can possibly work with XmlDocument, do so. Your code will be much
simpler and easier to maintain.
"Brian" <no****@hotmail.com> wrote in message
news:02****************************@phx.gbl...
Hi all,
I have an xml document that can contain 248 nodes with
each node containing different fields. There is the
possibility that there will be more nodes. Each node can
have up to 30 elements.
What do you suggest is the best way to parse through this
document? Should I create a class and deserialize the
xml into it? Should I create a giant parsing routine?
etc...
Thank everyone in advance for their answers!
Brian