XML Declaration versus Processing Instruction

One of the more needlessly confusing aspects of the XML specification is that for various technical reasons the following construct, which appears at the top of most XML documents, is in fact not a processing instruction:

 <?xml version="1.0"?> 

It looks like a processing instruction, but it isn't oneit's an XML declaration. Processing instruction targets are specifically forbidden from being xml , XML , Xml , or any other case combination of the word XML .

APIs may or may not expose the information in the XML declaration to the client application; but if one does, it will not use the same mechanism it uses to report processing instructions. For instance, in SAX 2.1 some of this information is optionally available through the Locator2 interface. However, the parser does not call the processingInstruction method in ContentHandler when it sees the XML declaration.



Effective XML. 50 Specific Ways to Improve Your XML
Effective XML: 50 Specific Ways to Improve Your XML
ISBN: 0321150406
EAN: 2147483647
Year: 2002
Pages: 144

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net