Using the SAX parser, you could get something similar to this: startElement( "tag1", ...) startElement( "tag2", ...) characters( "so", 2 ) characters( "me", 2 ) characters( "Dat", 3 ) characters( "a", 1 ) endElement( "tag2" ) endElement( "tag1" )
Basically in your handler for characters(), keep adding to a string object (I use a class data member). When endElement() is called, do what you need to do with the element "name" and its value stored in the class string object. Then make sure you erase the class string object before you return from the endElement() handler. Hope this helps. Tuan On Wed, 19 Dec 2001, Vinay Kakade wrote: > Hi, > > I have just started learning about Xerces C++ parser. I hope my question is >appropriate for this mailing list. > > My question is: In the characters() method of HandlerBase class, can we get the name >of the enclosing attribute in which in which this character data appear? > > For example: > > <tag1> > <tag2>someData</tag2> > </tag1> > > In this xml file, when characters() method is called when "someData" is encountered, >I want to retrieve name of enclosing attribute i.e. "tag2" in this case. > > Please let me know if there is any pre-implemented method to do this. I serached the >documentation but could not find any. > > Thanks in Advance, > -Vinay Kakade. > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
