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 Adam Fowler <af...@aber.ac.uk> on 2002/01/14 02:00:58 UTC
[xX][mM][lL] etc...
Hi all,
I'm having an error whilst reading XML. I've been using the
WrappedInput/OutputStream classes from the samples socket package. I
have an "XMLInterpreter" attached at each end of the a socket. (Client
server arrangement, serverSocket.accept() etc.)
For some reason, I'm getting the following error:-
startDocument
[Fatal Error] :-1:-1: The processing instruction target matching
"[xX][mM][lL]" is not allowed.
saxe whilst parsing!
org.xml.sax.SAXParseException: The processing instruction target
matching "[xX][mM][lL]" is not allowed.
at
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1110)
at
uk.ac.aber.compsci.aff9.common.xmltransport.XMLInterpreter$InputThread.run(XMLInterpreter.java:152)
The only thing I can see that I am doing different from the sample is
that instead of using a FileInputStream. I'm getting the text from an
XML file and putting it into a string, then writing the
bytes(String.getBytes()) to the WrappedOutputStream. I have tried
writing the String to a ByteArrayOutputStream (via an
OutputStreamWriter), getting the bytes from that, and then transmitting
over the network (localhost) but with no difference.
I am using the <?xml version... etc. and a DOCTYPE. This works with the
Sample application (I added a custom EntityResolver to point the parser
to the local dtd). It doesn't work without them either, though.
Any ideas?
Thanks,
Adam.
--
-------------------------------------------------------------------------
| Adam Fowler
|
| Third year undergraduate | TomcatBook Project
|
| Computer Science | Author and Administrator
|
| University of Wales, Aberystwyth | http://tomcatbook.sourceforge.net
|
| Web: http://users.aber.ac.uk/aff9 | E-mail: adamfowler@chillin.co.uk
|
-------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: [xX][mM][lL] etc...
Posted by Elliotte Rusty Harold <el...@metalab.unc.edu>.
At 1:00 AM +0000 1/14/02, Adam Fowler wrote:
>Hi all,
>
>I'm having an error whilst reading XML. I've been using the
>WrappedInput/OutputStream classes from the samples socket package. I
>have an "XMLInterpreter" attached at each end of the a socket. (Client
>server arrangement, serverSocket.accept() etc.)
>
>For some reason, I'm getting the following error:-
>
>startDocument
>[Fatal Error] :-1:-1: The processing instruction target matching
>"[xX][mM][lL]" is not allowed.
>saxe whilst parsing!
>org.xml.sax.SAXParseException: The processing instruction target
>matching "[xX][mM][lL]" is not allowed.
> at
>org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1110)
> at
>uk.ac.aber.compsci.aff9.common.xmltransport.XMLInterpreter$InputThread.run(XMLInterpreter.java:152)
>
>The only thing I can see that I am doing different from the sample is
>that instead of using a FileInputStream. I'm getting the text from an
>XML file and putting it into a string, then writing the
>bytes(String.getBytes()) to the WrappedOutputStream. I have tried
>writing the String to a ByteArrayOutputStream (via an
>OutputStreamWriter), getting the bytes from that, and then transmitting
>over the network (localhost) but with no difference.
>
>I am using the <?xml version... etc. and a DOCTYPE. This works with the
>Sample application (I added a custom EntityResolver to point the parser
>to the local dtd). It doesn't work without them either, though.
>
>Any ideas?
>
I'd guess there's a byte or two ahead of the XML declaration in your
string. Then the XML declaration would be treated as a processing
instruction and be illegal because of the name.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo@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/ |
+----------------------------------+---------------------------------+
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org