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

R

RamaKrishna Narla

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.
 
J

Joe Kesselman

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.)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top