sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Papastefanos Serafeim's Avatar

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
Martin Honnen's Avatar
Martin Honnen July 6th, 2006 05:45 PM
Guest - n/a Posts
#2: Re: Xerces-c / SAX question



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/
Joe Kesselman's Avatar
Joe Kesselman July 6th, 2006 05:55 PM
Guest - n/a Posts
#3: Re: Xerces-c / SAX question

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
Papastefanos Serafeim's Avatar
Papastefanos Serafeim July 7th, 2006 08:55 AM
Guest - n/a Posts
#4: Re: Xerces-c / SAX question

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



MANABHS@gmail.com's Avatar
MANABHS@gmail.com July 22nd, 2006 08:55 PM
Guest - n/a Posts
#5: Re: Xerces-c / SAX question

Serafeim, oxi sta ba8eia paidi mou.


( MANABHS )
http://www.tvradio.web1000.com

( twra exei 7150 radio & TV sta8mous )

 
Not the answer you were looking for? Post your question . . .
196,985 members ready to help you find a solution.
Join Bytes.com

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.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors