S
Steven Feil
I'm looking for simple examples of XML parsing using C/C++ that could
be applicable to both Unix and Windows programming. I am wanting to
parse an XML structure that is basically flat. The Information that I
wish to extract would be held within XML attributes. It is important
that the order of the document be preserved in the parsing process.
Here is a document similar to the type of XML that will be generated.
<collector name="John Tomas">
<cd title="Moon Light City" artist="Fred Ziffle" />
<book title="Hiking Big Bend" author="Laurence Parent" pages="171" />
<cd title="Ups and Downs" artist="Hank Kimble" />
<cd title="Eat My Shorts" artist="Bart Simpson" />
<book title="100 things to cook" author="Tom Duly" pages="100" />
</collector>
My program would need to know what order the information was
in. Specifically the cd "Moon Light City" was found first followed by
the book "Hiking Big Bend" and so forth. I would also need to extract
all the data, noting that the data for a cd is different than that for
a book.
I've looked into xpath, but what I've read about it so far seams much
more complicated than what I need. Most of the XML books I've seen
seem to concentrate on the DTD and interoperability between HTML and
XML. I've written a DTD that I believe is right, but I haven't tested
it yet.
Any websites or steering on what I should search the Internet for
would be greatly appreciated.
be applicable to both Unix and Windows programming. I am wanting to
parse an XML structure that is basically flat. The Information that I
wish to extract would be held within XML attributes. It is important
that the order of the document be preserved in the parsing process.
Here is a document similar to the type of XML that will be generated.
<collector name="John Tomas">
<cd title="Moon Light City" artist="Fred Ziffle" />
<book title="Hiking Big Bend" author="Laurence Parent" pages="171" />
<cd title="Ups and Downs" artist="Hank Kimble" />
<cd title="Eat My Shorts" artist="Bart Simpson" />
<book title="100 things to cook" author="Tom Duly" pages="100" />
</collector>
My program would need to know what order the information was
in. Specifically the cd "Moon Light City" was found first followed by
the book "Hiking Big Bend" and so forth. I would also need to extract
all the data, noting that the data for a cd is different than that for
a book.
I've looked into xpath, but what I've read about it so far seams much
more complicated than what I need. Most of the XML books I've seen
seem to concentrate on the DTD and interoperability between HTML and
XML. I've written a DTD that I believe is right, but I haven't tested
it yet.
Any websites or steering on what I should search the Internet for
would be greatly appreciated.