[jdom-interest] CDATA data (followup with more info)
Bradley S. Huffman
hip at a.cs.okstate.edu
Thu Nov 7 21:25:53 PST 2002
Malachi de AElfweald writes:
> Actually, not quite.
> the xml version declaration is a processor instruction.
No, it just looks like one, but it's not.
Go directly to the specification (http://www.w3.org/TR/REC-xml).
Productions 16 & 17 (the two productions for PIs) are:
 PI ::= '<?' PITarget ( S (Char* - (Char* - (Char* '?>' Char*)))? '?>'
 PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
Production 17 explicitly prohibits 'xml' in any form from being the target
for a PI, ergo <?xml version="1.0" ?> cannot be a processing instruction.
In fact the only production it matches is production 23 for a XML declaration.
 XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
> First link under google search for `xml "processing instruction" tutorial`
> brings up:
I'd say the actual specification would be a more authoritative source.
> All processing instructions, including the XML declaration, begin with <? and
> end with ?>.
Yes they both begin with <? and end with ?>, then again apples and oranges
both grow on trees, but they are not the same. Likewise the XML declaration
and PI's are not the same.
A couple more differences are the XML declaration, if it exists, must be the
first item in the document and the document can contain only one. In
contrast, there can be any number of PIs in a document, they don't have to
be unique, and they can occur in any order.
More information about the jdom-interest