Hi everyone,
Scanning the posts here, and having done some googling, I have to say
I'm feeling a bit overwhelmed at the moment.
I'm very new at this whole XML/DOM/SAX terminology...!
It's very simple, actually: I need to write a program to read in a
number of parameters from an XML file describing a particular satellite
data format.
The XML files I'm talking about typically contain ~8000 elements, but
I'll only need to extract a couple of dozen specific elements or so,
buried in various places in the file.
My target platform is linux, GNU C++ compiler.
The idea: read various specific XML elements and attributes into my own
data structures, so I can work with them.
Question (1):
What's the best way to extract a particular element value, where only
its name is known?
And can I extract attribute values as easily as element values?
Question (2):
The data I need to extract can be strings, short/long integers, or
single/double floats.
All the code examples I've seen so far have treated elements as strings.
What's the most elegant way to read in values of various types?
Do I really have to do after-the-fact conversions, for example using
atoi()? That seems a bit odd.
With all that said, what parser should I use? DOM? SAX2? And why?
I've already managed to run a few of the xerces test programs on one of
my XML files; it parses fine, I can count the elements, etc.
So at least I have some kind of ground to work on.
Can anyone here provide me with an example(s), esp. of how to extract
specific element values of non-string type?
I hope I was clear...thank you for all help!
Adrian