Xerces-c / SAX question

  • Thread starter Papastefanos Serafeim
  • Start date
P

Papastefanos Serafeim

Hello,
I have a problem with SAX on Xerces-c. What I want to do for
now is just save the name of each XML element in an array.

So, I've implemented my own startElement method. The problem is
that the startElement method has a parameter whose type is "const
XMLCh * const name". How can I produce a char * from that ?

I tried printing the name parameter but what I got was only the first
character of each node's name. What am I doing wrong ?

Thanks in advance!
 
M

Martin Honnen

Papastefanos Serafeim wrote:

So, I've implemented my own startElement method. The problem is
that the startElement method has a parameter whose type is "const
XMLCh * const name". How can I produce a char * from that ?

To support Unicode (which XML requires) char * would not suffice. There
is a Xerces-C user mailing list I think where you have more chances to
find someone familiar with the Xerces API.
 
J

Joe Kesselman

Papastefanos said:
that the startElement method has a parameter whose type is "const
XMLCh * const name". How can I produce a char * from that ?

XMLch is used because SAX wants to return UTF-16 characters. Looking at
the examples on Apache's website, it looks like you can invoke
XMLString::transcode to obtain a char*; it's your responsibility to
release it after you're done with it.

Examples and programming guides can be found at
http://xml.apache.org/xerces-c/apiDocs/index.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top