Xerces-c / SAX question

Papastefanos Serafeim

Usenet Archive
Joined
Jul 21, 2005
Messages
30
Reaction score
0
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!
 

Martin Honnen

Usenet Archive
Joined
Apr 8, 2000
Messages
6,174
Reaction score
0
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.
 

Joe Kesselman

Usenet Archive
Joined
Feb 3, 2006
Messages
1,229
Reaction score
0
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
548,049
Messages
3,104,245
Members
248,133
Latest member
DujonT

Latest Threads

Top