[Expat-discuss] Expat 1.95.8 fails on XML with newline

rolf at pointsman.de rolf at pointsman.de
Tue Dec 14 12:08:07 CET 2004


On 14 Dec, Enrico Weigelt wrote:
> * Karl Waclawek <karl at waclawek.net> wrote:
>> AFAIK, starting an XML document with whitespace is an error,
>> i.e. your document is not well-formed.
> 
> Nevertheless its bad behaviour of expat and shall be fixed.

Pardon? If an XML document starts with an XML declaration, then no
space in front of the XML declartion is allowed. See the production 1
and 22 of the XML recommendation. That are the rules, no room for
discussion; expat simply does the right thing, there's nothing to fix.

If you absolutely don't like this, then don't use XML or go and pester
the w3c XML group so that they change that in a new XML
recommendation. Additionally, you're free to strip all white space
prior to the XML declartion before you feed the data into the parser
(but if you exchange your XML data with others don't expect that they
also do this; you very probably will get complains). But the only good
option you have is, to fix your documents.

rolf




More information about the Expat-discuss mailing list