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 ra...@freddiemac.com on 2004/10/27 00:12:26 UTC
SAX parser claims document not well-formed
I am reading the data from file (pipe delimited) and then convert them to
XML and pass it to XML parser.
If I run the parser on Win-doze, it parses fine. But if I run it on AIX, I
get the following exception:
org.xml.sax.SAXParseException: The markup in the document following the
root element must be well-formed.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
The code that calls the parser is this:
parser.parse( new InputSource( input.toXMLString() ));
The method toXMLString returns ByteArrayInputStream.
Anyone knows why this is happening? My guess is a little-endian/big-endian
byte order issue. If so, how could I fix that? I tried setting the
encoding before I call the parse method. But no help.
Your help will be appreciated.
Thanks,
-ramin
Re: SAX parser claims document not well-formed
Posted by Murray Altheim <m....@open.ac.uk>.
ramin_rad@freddiemac.com wrote:
> I am reading the data from file (pipe delimited) and then convert them to
> XML and pass it to XML parser.
>
> If I run the parser on Win-doze, it parses fine. But if I run it on AIX, I
> get the following exception:
>
> org.xml.sax.SAXParseException: The markup in the document following the
> root element must be well-formed.
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
> Source)
>
> The code that calls the parser is this:
>
> parser.parse( new InputSource( input.toXMLString() ));
>
> The method toXMLString returns ByteArrayInputStream.
>
> Anyone knows why this is happening? My guess is a little-endian/big-endian
> byte order issue. If so, how could I fix that? I tried setting the
> encoding before I call the parse method. But no help.
Ramin,
Perhaps you could post the document somewhere and point us to
it so we could actually see the markup. Otherwise it's just a
guess. It doesn't sound like an encoding issue if the parser
was able to read past the XML and/or DOCTYPE declarations, which
it seems is happening if the error talks about *after* the root
element. (Note that XML documents can only contain one document
element.) There might be a difference beyond simply changing
from Windows to AIX that isn't immediately evident, and there's
not enough information provided to know. So looking at the
document would certainly help a bit.
[If the content is in any way sensitive, strip out the sensitive
parts, see if the error still occurs, then post and announce.]
Murray
......................................................................
Murray Altheim http://kmi.open.ac.uk/people/murray/
Knowledge Media Institute
The Open University, Milton Keynes, Bucks, MK7 6AA, UK .
[International terrorism] is a fantasy that has been exaggerated
and distorted by politicians. It is a dark illusion that has
spread unquestioned through governments around the world, the
security services, and the international media. In an age when
all the grand ideas have lost credibility, fear of a phantom
enemy is all the politicians have left to maintain their power."
The making of the terror myth, The Guardian
http://www.guardian.co.uk/terrorism/story/0,12780,1327904,00.html
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: SAX parser claims document not well-formed
Posted by Murray Altheim <m....@open.ac.uk>.
ramin_rad@freddiemac.com wrote:
> Just to give more information. This is not a byte-order issue as I
> originally suspected. The parsing validator runs fine if it is run stand
> alone. (I'll explain below.)
>
> I failed to tell you that I use Hibernate to store parsing errors in the
> database and hibernate stores it's Object-Relation mapping as XML files
> and it uses it's own parsing and my guess is that a listener initialized
> by Hibernate stays in the VM and my parser ends up using that and that'
> why I get a well-formed error.
>
> How can I find out what listener my parses uses? (XMLParserConfiguration
> or ComponentManager...)
>
> I still can't explain why this runs fine under windows... It may have
> semething to do with the way windows handles threads.
Ramin,
I don't use Hibernate, so the only thing I can suggest is to grep
the Hibernate code for "Listener", insert a bunch of printlns in
the code in places where the listeners are being added or removed
(with their object IDs), then see what happens.
Murray
......................................................................
Murray Altheim http://kmi.open.ac.uk/people/murray/
Knowledge Media Institute
The Open University, Milton Keynes, Bucks, MK7 6AA, UK .
[International terrorism] is a fantasy that has been exaggerated
and distorted by politicians. It is a dark illusion that has
spread unquestioned through governments around the world, the
security services, and the international media. In an age when
all the grand ideas have lost credibility, fear of a phantom
enemy is all the politicians have left to maintain their power."
The making of the terror myth, The Guardian
http://www.guardian.co.uk/terrorism/story/0,12780,1327904,00.html
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: SAX parser claims document not well-formed
Posted by ra...@freddiemac.com.
Just to give more information. This is not a byte-order issue as I
originally suspected. The parsing validator runs fine if it is run stand
alone. (I'll explain below.)
I failed to tell you that I use Hibernate to store parsing errors in the
database and hibernate stores it's Object-Relation mapping as XML files
and it uses it's own parsing and my guess is that a listener initialized
by Hibernate stays in the VM and my parser ends up using that and that'
why I get a well-formed error.
How can I find out what listener my parses uses? (XMLParserConfiguration
or ComponentManager...)
I still can't explain why this runs fine under windows... It may have
semething to do with the way windows handles threads.
Thanks,
-ramin
ramin_rad@freddiemac.com
10/26/2004 06:12 PM
Please respond to
xerces-j-user@xml.apache.org
To
xerces-j-user@xml.apache.org
cc
Subject
SAX parser claims document not well-formed
I am reading the data from file (pipe delimited) and then convert them to
XML and pass it to XML parser.
If I run the parser on Win-doze, it parses fine. But if I run it on AIX, I
get the following exception:
org.xml.sax.SAXParseException: The markup in the document following the
root element must be well-formed.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
The code that calls the parser is this:
parser.parse( new InputSource( input.toXMLString() ));
The method toXMLString returns ByteArrayInputStream.
Anyone knows why this is happening? My guess is a little-endian/big-endian
byte order issue. If so, how could I fix that? I tried setting the
encoding before I call the parse method. But no help.
Your help will be appreciated.
Thanks,
-ramin