At 06.08 20/12/2005 +0100, Markus Heller wrote:
Dear List,
> I would like to write a parser that gives me a tuple on each node: the path
> to a node and the pcdata, the container text. I managed to assemble the
> path information by recursively calling startElement from an instantiated
> defaultHandler.
>
> Though, now I would like to retrieve all that's in the container and I
> don't know how to do it best. Ideally, I would like to have the container
> contents together with the path information.
>
> How proceed?
Well, It seems I had an idea... There is that wonderful "characters" member
function in defaultHandler, respectively ContentHandler:
I have now tried it out, but the chars variable only gives me numbers instead
of chars:
(Quote from the documentation:)
void ContentHandler::characters ( const XMLCh *const chars,
const unsigned int length
)
I'm absolutely convinced that some of you know what I'm talking
about. Can you
give me a hint?
Hi Markus,
the "chars" variable contains the data, but encoded in UTF-16 (i.e.
unsigned short). You can use XMLString::transcode to convert it to
the local code page of your system.
Alberto