c++ Xalan1.4/Xerces2.1 SAX parser. How to find the encoding type?

Discussion in 'XML' started by RamaKrishna Narla, Aug 22, 2006.

  1. Hi,

    We are using Xalan1.4/Xerces2.1 SAX parser in C++. We have extended
    DocumentHandler class, and registered its object using
    setDocumentHandler method.
    SAX Parser is reporting the document related events like startDocument,
    startElement, endElement ...etc well.
    But, it is starting the events from the root node of the xml document,
    by calling startDocument method. We need to find out the encoding type
    specified in the <?xml version="..." encoding="..." ?> processing
    instruction.
    SAX parser is not invoking processingInstruction method for the above
    PI.

    Is there any way to find out the encoding type specified in the very
    first xml PI?

    Thanks in advance,
    Ramakrishna.
     
    RamaKrishna Narla, Aug 22, 2006
    #1
    1. Advertising

  2. Standard SAX does not yet expose the XML Declaration. The SAX2
    Extensions 1.1 Beta APIs add this as part of the Locator2 interface
    (see http://www.saxproject.org/sax2-ext.html), but that is still
    officially experimental.

    (Note also that DocumentHandler is an outdated interface; you should be
    using ContentHandler these days.)



    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
     
    Joe Kesselman, Aug 22, 2006
    #2
    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. Martin Schlatter

    Encoding problem with SAX parser

    Martin Schlatter, Dec 10, 2003, in forum: Java
    Replies:
    2
    Views:
    863
    Martin Schlatter
    Dec 14, 2003
  2. Replies:
    5
    Views:
    16,265
    Steve W. Jackson
    Sep 15, 2005
  3. Ethel
    Replies:
    1
    Views:
    569
    Martin Honnen
    Jun 20, 2006
  4. Åukasz
    Replies:
    2
    Views:
    1,607
    Stefan Behnel
    Aug 7, 2009
  5. Michel Demazure

    Nokogiri SAX parser encoding problem

    Michel Demazure, Aug 24, 2010, in forum: Ruby
    Replies:
    6
    Views:
    355
    Michel Demazure
    Aug 25, 2010
Loading...

Share This Page