XML Parse Error: Invalid xml declaration while using TXMLTransformProvider

Abstract: XML Parse Error: Invalid xml declaration while using TXMLTransformProvider

Information in this Brief applies to:

  • Delphi
  • Windows

Overview

Describes what happens when using an .xml file with a blank line as the first line in the document with a XMLTransformProvider

Details



XML Parse Error: Invalid xml declaration
Reason: Invalid xml declaration.
Error on line 2, position 3.

If you try opening up the .xml document inside Internet Explorer, you will not see the blank line. Open up the .xml file inside notepad or some similiar text editor. Delete the blank line at the top of the document and ensure the first line is the XML Identifier. This must appear at the start of the document as this allows a processor to read the first few bytes to determine which family of schemes is in use.