You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Allen Brookes <ab...@roguewave.com> on 2004/09/09 23:13:53 UTC
Whitespace in schema documents
Hi,
I'm using the xerces xs package to parse a schema. If I have any whitespace
before the prolog xs fails to parse the document. Whitespace anywhere else
doesn't seem to cause any problems. Shouldn't whitespace be allowed before
the prolog?
Thanks,
Allen
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Whitespace in schema documents
Posted by Steven Ihde <si...@cs.stanford.edu>.
On Thu, Sep 09, 2004 at 02:13:53PM -0700, Allen Brookes wrote:
> Hi,
>
> I'm using the xerces xs package to parse a schema. If I have any whitespace
> before the prolog xs fails to parse the document. Whitespace anywhere else
> doesn't seem to cause any problems. Shouldn't whitespace be allowed before
> the prolog?
No. Some older parsers allowed this but it is not permitted according
to the spec. Here is the production for "document" from the spec:
http://www.w3.org/TR/REC-xml/#NT-document
If you chase the links down, there is no white space allowed before
'<?xml'.
The spec also says in section 2.1:
2.1 Well-Formed XML Documents
[Definition: A textual object is a well-formed XML document if:]
1. Taken as a whole, it matches the production labeled document.
This seems to make it clear that ignoring leading whitespace is not
permissible.
Everywhere whitespace can appear in a document, it is explicitly
allowed by the grammar, represented by the production named "S":
http://www.w3.org/TR/REC-xml/#NT-S
-Steve
--
Steven C. Ihde <si...@cs.stanford.edu>
PGP Key ID: 0x7793756D
PGP Fingerprint: DC 55 8B CA 50 8B DD 75 67 45 96 4D FF 42 8A 6C
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org