[XML-SIG] how to get the 'codepage' from a xml document

Martin v. L÷wis martin@v.loewis.de
10 Jan 2003 11:47:10 +0100

"Remy C. Cool" <dev-xml@smartology.nl> writes:

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

If you are using SAX, I imagine you generate a *new* document, rather
than "inserting" into an existing document. In that case, the new
document could use a different encoding than the old one. Just use
UTF-8 for the new document (which is the default, anyway), and don't
worry about the encoding of the original document.