[Expat-discuss] XMLParserBuffer returns no element found!!!

rolf at pointsman.de rolf at pointsman.de
Wed Aug 23 21:48:59 CEST 2006


On 22 Aug, Michael B Allen wrote:
> On Wed, 23 Aug 2006 07:27:50 +0530
> Shishir.Rawat at rds.co.nz wrote:
> 
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> xmlfile.xml contains
>> 
>> <config>
>>         <builddate>2006-11-23</builddate>
>> </config>
>> 
>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 
> That's not a valid XML file. An XML file always begins with the <?xml
> version="1.0"?> processing instruction. 

This is not right. An XML file does not always have to begin with the
XML Declaration. See the production 22 of the XML recommendation
http://www.w3.org/TR/2004/REC-xml-20040204/#NT-prolog

If you encode your XML files in another encoding then UTF-8 you must
have an XML Declaration with the right Encoding Declaration, sure. But
if your XML data is encoded in UTF-8 - which is a good idea - you can
omit the XML Declaration and every compliant parser will grok your
document.

rolf




More information about the Expat-discuss mailing list