Can anyone tell me how can I get a tag name and tag value using the SAX API in Xerces-C++ v2.8.0?
SAX works by parsing the file and sending you events, in the form of callbacks to methods you provide. There are "events" for each significant object that can occur in an XML file, such as start-tag, characters, end-tag, etc. It is up to you to keep track of where you are and determine which of the events is meaningful to you.
You provide the callbacks by subclassing org.xml.sax.helpers.DefaultHandler
and overriding the methods for the events of interest. So, for example, you get a call to startElement()
for every tag in the XML. You look at each tag, and if it's of interest then you can examine its attributes, which were provided as a parameter to the startElement()
method.