[XML-SIG] how to get the 'codepage' from a xml document
Remy C. Cool
dev-xml@smartology.nl
Fri, 10 Jan 2003 11:27:15 +0100
On Friday 10 January 2003 10:55, Mike Brown wrote:
> Remy C. Cool wrote:
> > just have to find out how to get this implemented in a such a way
> > that I can pass the encoding to the parser.
>
> Why do you think you need to do this? A compliant parser is going
> to be autodetecting the encoding if you don't force it to use
> something else. Why do you want to do the autodetect externally?
My application appends/inserts data into an existing xml file ... some
what like a print queue. So I need the encoding to be able to create
'the new' xml file in the same encoding as the original and I don't
like to hardcode the encoding into the source. It uses no external
entity's (except for a DTD in plain ASCII) so that's not a problem.
I now have a function which extracts the encoding (if present) so I
can pass it to the parser.
Would be nice to be able to acces this kind of information with a
class (like ContentHandler) in sax.
Another solution to this problem would be to create only Unicode XML
files, but then there's the problem that not 'all' text editors
understand unicode.
> > Does anyone know where I can find an example on how to do this?
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52257
Found that yesterday :)
Thanks for your reply
>
> Mike