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

RamaKrishna Narla

Usenet Archive
Joined
Aug 22, 2006
Messages
1
Reaction score
0
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.
 

Joe Kesselman

Usenet Archive
Joined
Feb 3, 2006
Messages
1,229
Reaction score
0
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

No members online now.

Forum statistics

Threads
548,051
Messages
3,104,251
Members
248,135
Latest member
tobystanx

Latest Threads

Top