Sent before I thought that one through. The last STILL OPEN start element call that is.
You will have to maintain a stack of open elements.
In startElement(), stick the name on top of the stack.
In endElement(), remove the topmost element from the stack.
in characters(), the data belongs to the topmost element on stack.
 
Now my ramblings might even make sense to anyone :)
 
/ Erik
-----Original Message-----
From: Erik Rydgren [mailto:[EMAIL PROTECTED]]
Sent: den 19 december 2001 14:06
To: [EMAIL PROTECTED]
Subject: RE: How to get attribute name in characters() method?

Well the character data belongs to the last startElement call. Just store the name then.
 
/ Erik
-----Original Message-----
From: Vinay Kakade [mailto:[EMAIL PROTECTED]]
Sent: den 19 december 2001 12:48
To: [EMAIL PROTECTED]
Subject: How to get attribute name in characters() method?

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.
   

Reply via email to