You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Heeg, Michael" <He...@fev.de> on 2004/09/01 15:08:03 UTC

Question concerning DOMBuilder and encoding

Hi everybody,

I have a problem with parsing a local file into a DOM. I found out that the
reason is the encoding the DOMBuilder uses (UTF-8 by default?), but I did
not find a way how to change it.

The problem is, that the local file has NO header line which sets the
encoding like
"<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>"
If I add this line to the local file, the parsing works fine. But if I
delete this line, the parsing process terminates with an exception, because
the document contains special characters like "°C" for degree Celsius. And:
due to compatibility it is not possible to include the header line in the
local files.

My question: is it possible to set the encoding the DOMBuilder should use
outside of the local file?

Thanks for your help!

Best regards,
Michael Heeg


Here are some fragments of my sources:

//member variables
DOMDocument* m_domDoc;
DOMBuilder* m_domBuilder;

//set external schema path
XMLCh* propVal = XMLString::transcode("c:\myschema.xsd");
m_domBuilder->setProperty(XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLoc
ation, propVal);

//parse document, transfer into the DOMDocument
m_domDoc = m_domBuilder->parseURI("c:\myfile.txt");

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org