Xerces-c / SAX question

Discussion in 'XML' started by Papastefanos Serafeim, Jul 6, 2006.

  1. 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
     
    Papastefanos Serafeim, Jul 6, 2006
    #1
    1. Advertising

  2. 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/
     
    Martin Honnen, Jul 6, 2006
    #2
    1. Advertising

  3. 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
     
    Joe Kesselman, Jul 6, 2006
    #3
  4. Thanks for the answers.
    XMLString::transcode() was just fine :)

    --
    Papastefanos Serafeim

    ? "Joe Kesselman" ?????? ??? ?????? news:44ae91d5$...
    > 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
     
    Papastefanos Serafeim, Jul 7, 2006
    #4
  5. Papastefanos Serafeim

    Guest

    , Jul 22, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pascal Lagass?
    Replies:
    2
    Views:
    815
    Pascal Lagass?
    Mar 1, 2004
  2. John Smith

    Xerces SAX encoding problems

    John Smith, Sep 21, 2005, in forum: Java
    Replies:
    1
    Views:
    2,039
    Roedy Green
    Sep 21, 2005
  3. John Smith
    Replies:
    3
    Views:
    2,015
    Roedy Green
    Sep 27, 2005
  4. cvissy
    Replies:
    0
    Views:
    637
    cvissy
    Nov 16, 2004
  5. Replies:
    0
    Views:
    248
Loading...

Share This Page