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 Prashant <pr...@pramati.com> on 2006/03/27 17:16:27 UTC

White spaces before Processing Instruction

Can Parser be forgiving about the white spaces before <?xml processing 
instruction ?

I saw the code in XMLDocumentScannerImpl and noticed that there no way 
around this. I wonder what the motivation is for parser to behave so in 
handling the processing instruction.

-Prashant



---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: White spaces before Processing Instruction

Posted by David Sheldon <da...@earth.li>.
On Mon, Mar 27, 2006 at 08:46:27PM +0530, Prashant wrote:
> 
> Can Parser be forgiving about the white spaces before <?xml processing 
> instruction ?
> 
> I saw the code in XMLDocumentScannerImpl and noticed that there no way 
> around this. I wonder what the motivation is for parser to behave so in 
> handling the processing instruction.

As you can see from the XML specification
(http://www.w3.org/TR/REC-xml/#NT-prolog) if a document has whitespace
before the <?xml then it isn't a valid XML document. 

David

-- 
A debugged program is one for which you have not yet found the conditions
that make it fail.
		-- Jerry Ogdin

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: White spaces before Processing Instruction

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Prashant <pr...@pramati.com> wrote on 03/27/2006 10:16:27 AM:

> 
> Can Parser be forgiving about the white spaces before <?xml processing 
> instruction ?

No. The XML declaration [1] (which by the way is not a processing 
instruction, even though it looks like one) cannot [2] be preceded by 
whitespace. If it is then your document isn't well-formed and you'll get a 
fatal error.

> I saw the code in XMLDocumentScannerImpl and noticed that there no way 
> around this. I wonder what the motivation is for parser to behave so in 
> handling the processing instruction.
> 
> -Prashant
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org

[1] http://www.w3.org/TR/2004/REC-xml-20040204/#NT-XMLDecl
[2] http://www.w3.org/TR/2004/REC-xml-20040204/#NT-prolog

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: White spaces before Processing Instruction

Posted by Joseph Kesselman <ke...@us.ibm.com>.
>Can Parser be forgiving about the white spaces before <?xml processing
>instruction ?

Per the XML spec, nothing may preceed the XML Declaration except a Byte
Order Mark, and the XML Parser should enforce that rule.

I'd suggest you set up a stream filter which discards leading space, and
parse from that, if you really want to relax this restriction.

______________________________________
"... Three things are most perilous: Connectors that corrode,
  Unproven algorithms, and self-modifying code! ..."
  -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish
(http://www.ovff.org/pegasus/songs/threes-rev-11.html)


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org