Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Xerces-c / SAX question

Reply
Thread Tools

Xerces-c / SAX question

 
 
Papastefanos Serafeim
Guest
Posts: n/a
 
      07-06-2006
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


 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      07-06-2006


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.

--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      07-06-2006
Papastefanos Serafeim wrote:
> 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
 
Reply With Quote
 
Papastefanos Serafeim
Guest
Posts: n/a
 
      07-07-2006
Thanks for the answers.
XMLString::transcode() was just fine

--
Papastefanos Serafeim

? "Joe Kesselman" ?????? ??? ?????? news:44ae91d5$(E-Mail Removed)...
> Papastefanos Serafeim wrote:
>> 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



 
Reply With Quote
 
MANABHS@gmail.com
Guest
Posts: n/a
 
      07-22-2006
Serafeim, oxi sta ba8eia paidi mou.


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

( twra exei 7150 radio & TV sta8mous )

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SAX callback method question steve_marjoribanks@hotmail.com Java 8 02-27-2006 11:00 AM
SAX XMLReader, XMLFilter, ContentHandler and XMLWriter question Jeff Calico XML 2 02-22-2006 06:13 PM
SAX Question - P G Java 0 05-23-2004 01:33 AM
Parsing XML file with Sax question... Nathaniel Hughes Java 1 01-14-2004 03:03 AM



Advertisments