Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > c++ Xalan1.4/Xerces2.1 SAX parser. How to find the encoding type?

Thread Tools

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

RamaKrishna Narla
Posts: n/a

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
SAX parser is not invoking processingInstruction method for the above

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

Thanks in advance,

Reply With Quote
Joe Kesselman
Posts: n/a
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, 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
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Sax Parser problem : xml encoding of string?? Java 5 09-15-2005 03:58 PM
SaX,, Xerces: parse() and IOException caused by wrong URI-encoding ? Pascal Lagass? Java 2 03-01-2004 08:44 AM
Encoding problem with SAX parser Martin Schlatter Java 2 12-14-2003 10:33 AM