[jdom-interest] Crimson bug

Elliotte Rusty Harold elharo at metalab.unc.edu
Thu Sep 6 05:51:08 PDT 2001

At 12:27 PM +1000 9/6/01, Jeff Turner wrote:
>On Wed, Sep 05, 2001 at 08:45:20PM -0400, Jon Baer wrote:
>> Hey can I ask a question ...
>> Why is it that on mainly all the parsers I use that <?xml version="1.0"?> is a
>> *required* factor?  Im not sure if this relates to this bug but if its considered a
>> PI for mainly all applications which may use a stylesheet in the end shouldn't this
>> be an optional factor?
>Perhaps it's just that when you leave it out, you then have whitespace
>before the first tag, which is definitely not allowed.

Not the case here, but even if it were white space is allowed before the root element start tag. Here are the relevant productions:

[3] S ::= (#x20 | #x9 | #xD | #xA)+
[22] prolog  ::= XMLDecl? Misc* (doctypedecl Misc*)?
[27]  Misc ::= Comment | PI | S

Note that you can omit both the XML declaration and the DOCTYPE declaration and still have white space in the prolog. You can't have white space before the XML declaration iff the XML declaration is present, but you can have it after the XML declaration or when there is no XML declaration. 

| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|              http://www.ibiblio.org/xml/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      | 
|  Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/     |

More information about the jdom-interest mailing list