Determine encoding of XML file with xerces-c and SAXParser

Discussion in 'XML' started by christian.eickhoff@nt.uni-saarland.de, Jan 24, 2007.

  1. -saarland.de

    -saarland.de Guest

    Hello Everyone,

    I am facing a problem which should be relatively easy to solve for XML
    or XERCES experts. I am parsing my XML instance using xerces-c
    SAXParser. For internal purposes, it is essential to determine the
    charset encoding which is usually indentified within the header of the
    XML file e.g. <?xml version="1.0" encoding="UTF-8" ?>
    After a query in the xerces-c API documentation I guess that:

    - XMLDecl(const XMLCh *const versionStr, const XMLCh *const
    encodingStr, const XMLCh *const standaloneStr, const XMLCh *const
    actualEncodingStr)

    should be the right method to detect the according encoding scheme.
    After desperate tries to implement this function, I would like to ask
    whether somebody has example code in c++ for me as I am almost about to
    faint.. Should be very easy actually but maybe I am just not clever
    enough to solve myself.. =((

    Every code snippet is highly appreciated!!!!

    Thanks in advance,
    Chris
     
    -saarland.de, Jan 24, 2007
    #1
    1. Advertising

  2. -saarland.de wrote:
    > Hello Everyone,
    >
    > I am facing a problem which should be relatively easy to solve for XML
    > or XERCES experts. I am parsing my XML instance using xerces-c
    > SAXParser. For internal purposes, it is essential to determine the
    > charset encoding which is usually indentified within the header of the
    > XML file e.g. <?xml version="1.0" encoding="UTF-8" ?>


    getEncoding()




    // Magnus
     
    Magnus Henriksson, Jan 25, 2007
    #2
    1. Advertising

  3. Magnus Henriksson wrote:
    > -saarland.de wrote:
    >> Hello Everyone,
    >>
    >> I am facing a problem which should be relatively easy to solve for XML
    >> or XERCES experts. I am parsing my XML instance using xerces-c
    >> SAXParser. For internal purposes, it is essential to determine the
    >> charset encoding which is usually indentified within the header of the
    >> XML file e.g. <?xml version="1.0" encoding="UTF-8" ?>

    >
    > getEncoding()
    >


    Sorry, upon further inspection it turns out that this does not work the
    same as it does in Java (which I assumed). Can't help you...


    // Magnus
     
    Magnus Henriksson, Jan 25, 2007
    #3
    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. Per Magnus L?vold
    Replies:
    0
    Views:
    2,022
    Per Magnus L?vold
    Nov 16, 2004
  2. hitectahir

    Speeding up Xerces SAXParser

    hitectahir, Sep 20, 2003, in forum: XML
    Replies:
    0
    Views:
    436
    hitectahir
    Sep 20, 2003
  3. mel-tey chamon!
    Replies:
    2
    Views:
    1,367
    Patrick TJ McPhee
    May 16, 2004
  4. cvissy
    Replies:
    0
    Views:
    609
    cvissy
    Nov 16, 2004
  5. Mize-ze

    SAXParser inner XML of entity

    Mize-ze, Jul 12, 2007, in forum: Java
    Replies:
    2
    Views:
    415
Loading...

Share This Page