I have legacy code (I didn't write it) that always included the encoding attribute, but recompiling it to D2010, TXMLDocument doesn't include the enconding anymore. Because the XML data have accented characters both on tags and data, TXMLDocument.LoadFromFile simply throws EDOMParseErros saying that an invalid character is found on the file. Relevant code:
Doc := TXMLDocument.Create(nil);
try
Doc.Active := True;
Doc.Encoding := XMLEncoding;
RootNode := Doc.CreateElement('Test', '');
Doc.DocumentElement := RootNode;
<snip>
//Result := Doc.XMl.Text;
Doc.SaveToXML(Result); // Both lines gives the same result
On older versions of Delphi, the following line is generated:
<?xml version="1.0" encoding="ISO-8859-1"?>
On D2010, this is generated:
<?xml version="1.0"?>
If I change manually the line, all works like always worked in the last years.
UPDATE: XMLEncoding is a constant and is defined as follow
XMLEncoding = 'ISO-8859-1';