Xerces C++ and DOM trees

P

Peter Saffrey

I am hoping to use the Xerces libraries to read and process XML files
for my applications. What I want is to parse some XML and extract
information from particular tags, something which should be fairly
standard.

Using the examples from the API documentation
(http://xml.apache.org/xerces-c/program-dom.html#XercesDOMParser) I
have something which compiles and parses (as far as I can tell -
there's no output) but I can't find anything in the documentation
which tells me how to search or print the constructed object. What are
the methods to do this? Can somebody point me at the right section of
documentation?

The examples in the "samples" directory of the xerces release are all
rather verbose - the DOMCount example is several thousand lines for a
simple task, but to handle a wide variety of exceptional cases. What I
want is a hundred line example that parses a vanilla XML file searches
for a named tag and outputs the value in that tag, letting me add
extra complexity later - any idea where I can find such an example?

Thanks,

Peter
 
M

Martin Honnen

Peter Saffrey wrote:

Using the examples from the API documentation
(http://xml.apache.org/xerces-c/program-dom.html#XercesDOMParser) I
have something which compiles and parses (as far as I can tell -
there's no output) but I can't find anything in the documentation
which tells me how to search or print the constructed object. What are
the methods to do this? Can somebody point me at the right section of
documentation?

It is W3C DOM so at least "searching" is possible with methods like
getElementsByTagName and getElementsByTagNameNS of nodes.
<http://xml.apache.org/xerces-c/ApacheDOMC++BindingL2.html#A: Document Object Model: Core>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top