You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Hugh Greene <hg...@netphysic.com> on 2001/10/02 19:06:42 UTC

Crimson 1.1.1 and 1.1.2beta2 don't like XML decls?

Hi there,

I'm trying to use Crimson (via JAXP 1.1) to parse some XML files and it 
seems to throw exceptions if a file begins with an XML declaration.  I've 
tried both 1.1.1 (from the JAR which comes with Sun's JAXP 1.1 download) 
and 1.1.2beta2 (which seems to work fine as a direct replacement for the 
above, without me needing to upgrade to JDK 1.4).  This isn't urgent, as I 
don't currently care too much about the XML decls, but it seems like a 
pretty fundamental bug (or error on my part, of course ;-).

In particular, the message it gives is "XML declaration may only begin 
entities."  The stack trace (which I don't have to hand) shows the call 
path (in org.apache.Crimson.Parser2) as being parseInternal:487 -> 
maybeMisc:1088 -> maybePI:966 (line numbers from 1.1.2beta2 source 
code).  This suggests that for some reason maybeXmlDecl is failing to 
recognise the declaration, but I can't understand why.  It's just the usual 
'<?xml version="1.0"?>', it's right at the start of the file, and the 
file's just a typical Windows file with CR-LF line endings.

I can provide a reproducible case on request, I'm sure.

Any clues?  Is this a known bug?  Or is it obvious where I'm going wrong?

Thanks in advance,
Hugh


---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Re: Crimson 1.1.1 and 1.1.2beta2 don't like XML decls?

Posted by Andy Clark <an...@apache.org>.
Hugh Greene wrote:
> path (in org.apache.Crimson.Parser2) as being parseInternal:487 ->

Just a guess based on your post, but... Internal entities 
are not allowed to contain the XML/text declaration. The XML 
declaration is only for the document instance; whereas the 
Text declaration is for external parsed entities. (Both look
like <?xml ...?>, though.)

-- 
Andy Clark * IBM, TRL - Japan * andyc@apache.org

---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Re: Crimson 1.1.1 and 1.1.2beta2 don't like XML decls?

Posted by Edwin Goei <ed...@sun.com>.
Hugh Greene wrote:
> 
> In particular, the message it gives is "XML declaration may only begin
> entities."  The stack trace (which I don't have to hand) shows the call
> path (in org.apache.Crimson.Parser2) as being parseInternal:487 ->
> maybeMisc:1088 -> maybePI:966 (line numbers from 1.1.2beta2 source
> code).  This suggests that for some reason maybeXmlDecl is failing to
> recognise the declaration, but I can't understand why.  It's just the usual
> '<?xml version="1.0"?>', it's right at the start of the file, and the
> file's just a typical Windows file with CR-LF line endings.
> 
> I can provide a reproducible case on request, I'm sure.
> 
> Any clues?  Is this a known bug?  Or is it obvious where I'm going wrong?

Could you attach an input file that exhibits the problem?  Crimson
strictly follows the XML spec in that no whitespace can appear before
the XMLDecl in the document.  The stack trace seems to suggest that the
XMLDecl is not at the start of the file.

-Edwin

---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org