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:
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.