SAXParseException

Discussion in 'Java' started by Angela Stempfel, Oct 22, 2003.

  1. 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
    Angela Stempfel, Oct 22, 2003
    #1
    1. Advertising

  2. "Angela Stempfel" <> wrote in message
    news:bn5h3q$tk0di$-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() );
    William Brogden, Oct 22, 2003
    #2
    1. Advertising

  3. Angela Stempfel <> wrote in message news:<bn5h3q$tk0di$-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.
    Chris Riesbeck, Oct 22, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marc Jordant

    SAXParseException in JSP

    Marc Jordant, Apr 7, 2004, in forum: Java
    Replies:
    0
    Views:
    685
    Marc Jordant
    Apr 7, 2004
  2. Nick
    Replies:
    0
    Views:
    3,191
  3. Marcin Cenkier
    Replies:
    2
    Views:
    6,219
    Marcin Cenkier
    Jan 19, 2006
  4. Replies:
    4
    Views:
    640
    Diez B. Roggisch
    Mar 27, 2007
  5. Replies:
    0
    Views:
    2,713
Loading...

Share This Page