cybertextron
cybertextron

Reputation: 10971

retrieving the value between tags XML Xerces C++ Parser

I'm currently using Xerces library to parse a XML file in C++. I have the algorithm parser written, and the only thing missing is how to retrieve the value between two tags? For example, <name>John</name>, I would like to be able to get the value John, so I could store in a string variable which I have for that purpose. I know that using

DOMElement * current = root->getFirstChildElement();
const XMLCh * tag = current->getTagName();
cout << XMLString::transcode(tag) << endl;

I will be able to print that tag, but I'm more interested in the value between tags. Any ideas?

Upvotes: 1

Views: 2886

Answers (2)

reevh
reevh

Reputation: 765

DOMNode::getTextContent() will give you John from your example

Upvotes: 5

Steve H.
Steve H.

Reputation: 6947

Have you tried current->getNodeValue() ?

Upvotes: 0

Related Questions