Re: Illegal XML character SAX Parser exception

Discussion in 'Java' started by William Brogden, Jun 27, 2003.

  1. "Manoj S. P." <> wrote in message
    news:...
    > Thanks for the direction, William.
    > However, the exception gives me a valid line number (461) but an
    > invalid comiln number (-1) !!!
    > I will be grateful if you could help me further to resolve this
    > problem.
    > Best Regards,
    > Manoj


    I would start by examining the vicinity of the start of line 461 with
    a hex editor - there may be a character there that your regular
    editor does not show or renders as ?
    Personally I use UltraEdit-32 for such tasks.

    >
    > "William Brogden" <> wrote in message

    news:<3efb6576$>...
    > > "Manoj S. P." <> wrote in message
    > > news:...
    > > > Hi folks,
    > > >
    > > > I am facing a peculiar problem with the SAX Parser.
    > > > Among other imports within the code, the below packages are being used
    > > > for the XML part.
    > > >
    > > > import com.sun.xml.parser.Resolver;
    > > > import com.sun.xml.tree.ElementNode;
    > > > import com.sun.xml.tree.XmlDocument;
    > > >
    > > > import org.w3c.dom.Node;
    > > > import org.w3c.dom.NodeList;
    > > > import org.xml.sax.InputSource;
    > > >
    > > > I get an Exception which goes like this:
    > > > org.xml.sax.SAXParseException: Illegal XML character: .
    > > > org.xml.sax.SAXParseException: Illegal XML character: .
    > > > at com.sun.xml.parser.InputEntity.fatal(InputEntity.java:976)

    > >
    > > You can get the line number and column number out of that

    SAXParseException
    > > and find out exactly where in the file the problem is. See the
    > > SAXParseException
    > > Javadocs.
    > > > The encoding specified is Cp1252 which is supported in Java.
    > > > I do not understand which character in the XML document is causing
    > > > this problem.

    > >
    > >
    > >
    > >
    > >
    > > ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet

    News==----
    > > http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000

    Newsgroups
    > > ---= 19 East/West-Coast Specialized Servers - Total Privacy via

    Encryption =---




    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
    William Brogden, Jun 27, 2003
    #1
    1. Advertising

  2. William Brogden

    Manoj S. P. Guest

    Thanks once again, William.
    I have been able to identify the column having the incorrect data with
    the help of the Xerces DOM Parser (initially I was using the one
    provided alongwith the j2sdk1.3.0). It accurately gave me the line
    number and the column number (461 again!!!).
    Temporarily, I have decided to eliminate the data and replaced it with
    a null value. However, it hasn't been identified yet. Maybe I will
    resort to UltraEdit-32.
    I have covered illegal XML charcters like "&",">","<","'".
    I hope to cover some more at a later stage.
    I am also going to post another titled "Execution time problem with
    Insert Query using Prepared Statement".
    If possible, please help me with that too :)
    Thansk once again for the help.

    Best Regards,
    Manoj S. Panicker

    "William Brogden" <> wrote in message news:<3efc4af2$>...
    > "Manoj S. P." <> wrote in message
    > news:...
    > > Thanks for the direction, William.
    > > However, the exception gives me a valid line number (461) but an
    > > invalid comiln number (-1) !!!
    > > I will be grateful if you could help me further to resolve this
    > > problem.
    > > Best Regards,
    > > Manoj

    >
    > I would start by examining the vicinity of the start of line 461 with
    > a hex editor - there may be a character there that your regular
    > editor does not show or renders as ?
    > Personally I use UltraEdit-32 for such tasks.
    >
    > >
    > > "William Brogden" <> wrote in message

    > news:<3efb6576$>...
    > > > "Manoj S. P." <> wrote in message
    > > > news:...
    > > > > Hi folks,
    > > > >
    > > > > I am facing a peculiar problem with the SAX Parser.
    > > > > Among other imports within the code, the below packages are being used
    > > > > for the XML part.
    > > > >
    > > > > import com.sun.xml.parser.Resolver;
    > > > > import com.sun.xml.tree.ElementNode;
    > > > > import com.sun.xml.tree.XmlDocument;
    > > > >
    > > > > import org.w3c.dom.Node;
    > > > > import org.w3c.dom.NodeList;
    > > > > import org.xml.sax.InputSource;
    > > > >
    > > > > I get an Exception which goes like this:
    > > > > org.xml.sax.SAXParseException: Illegal XML character: .
    > > > > org.xml.sax.SAXParseException: Illegal XML character: .
    > > > > at com.sun.xml.parser.InputEntity.fatal(InputEntity.java:976)
    > > >
    > > > You can get the line number and column number out of that

    > SAXParseException
    > > > and find out exactly where in the file the problem is. See the
    > > > SAXParseException
    > > > Javadocs.
    > > > > The encoding specified is Cp1252 which is supported in Java.
    > > > > I do not understand which character in the XML document is causing
    > > > > this problem.
    Manoj S. P., Jun 30, 2003
    #2
    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. Michael Lee
    Replies:
    0
    Views:
    1,550
    Michael Lee
    Jun 27, 2003
  2. Jens Mueller
    Replies:
    0
    Views:
    605
    Jens Mueller
    Apr 12, 2005
  3. Andy Fish

    illegal character in xml file

    Andy Fish, Feb 6, 2007, in forum: XML
    Replies:
    1
    Views:
    539
    Joseph Kesselman
    Feb 6, 2007
  4. Sanjeev
    Replies:
    4
    Views:
    1,444
    Stanimir Stamenkov
    May 4, 2008
  5. Erik Wasser
    Replies:
    5
    Views:
    452
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page