[xml] get encoding from SAX parser



Hi,

I'm wondering how I can determine the encoding of an document (I don't mean the internal UTF-8 encoding) parsed with the SAX interface. I create the 'xmlParserCtxt' with 'xmlCreateIOParserCtxt(..., XML_CHAR_ENCODING_NONE)', register my callbacks and call 'xmlParseDocument()'. The encoding field of the 'xmlParserCtxt' is empty during the execution of my callbacks and the 'processingInstruction' callback is never called for the '<?xml version="1.0" encoding="ISO-8859-1"?>' PI.

Is there a solution with libxml2, or must I parse the document declaration on my own?

Thank you very much for your support so far! :-)

PS.: can line 6 in Makefile.am changed to:

INCLUDES = -I$(top_builddir)/include -I srcdir@/include @THREAD_CFLAGS@ @Z_CFLAGS@

this is needed for compilation outside of the original source-directory.

Ciao,
....................................................................
Marc Ewert                neofonie GmbH        Tel: +49.30.24627-241
Projektleitung            Robert-Koch-Platz 4  FAX: +49.30.24627-120
ewert neofonie de         D-10115 Berlin       Web: www.neofonie.de




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]