Xerces-c / SAX question
Question posted by: Papastefanos Serafeim
(Guest)
on
July 6th, 2006 05:35 PM
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!
--
Papastefanos Serafeim
4
Answers Posted
Papastefanos Serafeim wrote:
Quote:
Originally Posted by
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.
--
Martin Honnen
http://JavaScript.FAQTs.com/
Papastefanos Serafeim wrote:
Quote:
Originally Posted by
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
Thanks for the answers.
XMLString::transcode() was just fine :)
--
Papastefanos Serafeim
? "Joe Kesselman" ?????? ??? ?????? news:44ae91d5$1@news.greennet.net...
Quote:
Originally Posted by
Papastefanos Serafeim wrote:
Quote:
Originally Posted by
>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
|
|
|
What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 196,985 network members.
Top Community Contributors
|