Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SAXParseException

16 views
Skip to first unread message

Angela Stempfel

unread,
Oct 22, 2003, 5:02:22 AM10/22/03
to
Hi all

while parsing a file i get the following error:

org.xml.sax.SAXParseException: Content is not allowed in trailing section.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
at nesuto.parser.OsParser.<init>(OsParser.java:68)
at
nesuto.gui.JPanelNetwork.jbuttonScan_actionPerformed(JPanelNetwork.java:319)
at
nesuto.gui.JPanelNetwork_jbuttonScan_actionAdapter.actionPerformed(JPanelNetwork.java:765)
.................................

What does this error mean? I don't understand where it comes from. This
is the code where the error occurs:

try {
XMLReader xr = XMLReaderFactory.createXMLReader();
xr.setContentHandler(this);
xr.setErrorHandler(this);
FileReader r = new FileReader(xmlFile);
->> xr.parse(new InputSource(r));
}

I parse another file as well, in the same way...but there is no error.
Could there be something wrong with the xml Format?

Thanks for every help in advance

Angela

William Brogden

unread,
Oct 22, 2003, 10:31:38 AM10/22/03
to

"Angela Stempfel" <hip...@gmx.ch> wrote in message
news:bn5h3q$tk0di$1...@ID-131893.news.uni-berlin.de...

> Hi all
>
> while parsing a file i get the following error:
>
> org.xml.sax.SAXParseException: Content is not allowed in trailing section.
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
> Source)
> at nesuto.parser.OsParser.<init>(OsParser.java:68)
> at
>
nesuto.gui.JPanelNetwork.jbuttonScan_actionPerformed(JPanelNetwork.java:319)
> at
>
nesuto.gui.JPanelNetwork_jbuttonScan_actionAdapter.actionPerformed(JPanelNet
work.java:765)
> .................................
>
> What does this error mean? I don't understand where it comes from.

To locate what it is objecting to, extract the line number and column number
from the SAXParseException with something like:

}catch(SAXParseException spe ){
StringBuffer sb = new StringBuffer( spe.toString() );
sb.append("\n Line number: " + spe.getLineNumber());
sb.append("\nColumn number: " + spe.getColumnNumber() );
sb.append("\n Public ID: " + spe.getPublicId() );
sb.append("\n System ID: " + spe.getSystemId() + "\n");
log.println( sb.toString() );


Chris Riesbeck

unread,
Oct 22, 2003, 1:27:30 PM10/22/03
to
Angela Stempfel <hip...@gmx.ch> wrote in message news:<bn5h3q$tk0di$1...@ID-131893.news.uni-berlin.de>...
> Hi all
>
> while parsing a file i get the following error:
>
> org.xml.sax.SAXParseException: Content is not allowed in trailing section.
>
> I parse another file as well, in the same way...but there is no error.
> Could there be something wrong with the xml Format?
>
Mostly like something wrong with the XML file, e.g.,
extra characters after the last closing tag.
0 new messages