XML parsing with xerces

G

Gianni Mariani

MBR said:
Help!

Does anybody know a simple example how to use xerces
(http://xml.apache.org) with C++ to parse a simple xml file, go from
node to node and read the data in the nodes?

I suggest you try the Xerces forums. They probably know alot more that
those answering questions in this NG. This question really is not
on-topic here. Read the FAQ. http://www.parashift.com/c++-faq-lite/

BTW - I've used libxml2 http://xmlsoft.org/ . It's simpler than Xerces
IMHO and has a C++ http://libxmlplusplus.sourceforge.net/ - although
it's pretty trivial to roll your own.

G
 
R

Rolf Magnus

MBR said:
Help!

Does anybody know a simple example how to use xerces
(http://xml.apache.org) with C++ to parse a simple xml file, go from
node to node and read the data in the nodes?

Uhm, what about the xerces code samples from ... well ... just the site you
mentioned?
 
M

MBR

Hi,

probably I was not specific enough.

I try the sample from the xerces homepage
http://xml.apache.org/xerces-c/program-dom.html, take the iterator and
step through the tree:

for (DOMNode* pCurrent = iterator->nextNode();pCurrent != 0; pCurrent
= iterator->nextNode())
{
string strValue = XMLString::transcode(pCurrent->getNodeValue());
std::cout << strValue << std::endl;
(...)
}

With that way I can retrieve the values from the tree. Now, how can I
get the element structure? How can I query the attribute?

Thanks,

Matthias
 
R

red floyd

MBR said:
Hi,

probably I was not specific enough.

[redacted]

With that way I can retrieve the values from the tree. Now, how can I
get the element structure? How can I query the attribute?

[redacted]

No, you were specific enough. The problem is that how to use Xerces (or
insert your favorite third party library here) is Off Topic for c.l.c++.
You might be better off in comp.text.xml, or on an apache specific forum.
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top