org.xml.sax.SAXParseException: Document root element is missing

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: org.xml.sax.SAXParseException: Document root element is missing

  1. #1
    Join Date
    Sep 2008

    Smile org.xml.sax.SAXParseException: Document root element is missing

    I have a java file in which i parse a xml file

    URL url = new URL(address);
    con = (HttpURLConnection)(url.openConnection());
    DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
    Document doc = docBuilder.parse(in);

    Error occurs in the last line only for some xml files.
    the xml files are well formed and is downloaded from google so no error can be in that ,
    what may the reason for the error.
    the error is as follows
    org.xml.sax.SAXParseException: Document root element is missing
    at org.apache.crimson.parser.Parser2.fatal(
    at org.apache.crimson.parser.Parser2.fatal(
    at org.apache.crimson.parser.Parser2.parseInternal(
    at org.apache.crimson.parser.Parser2.parse(
    at org.apache.crimson.parser.XMLReaderImpl.parse(
    at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(
    at javax.xml.parsers.DocumentBuilder.parse(
    at com.df.semtools.adwords.GetAdwordsStats.getKeywords(
    Thanks for ur help in advance

  2. #2
    Join Date
    Apr 2007
    Sterling Heights, Michigan
    Welcome to DevX

    Can you post the contents of your applicationContext.xml file? It looks like you're missing the root element.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. MS Word from ASP.NET
    By michurin in forum ASP.NET
    Replies: 0
    Last Post: 07-10-2007, 11:21 AM
  2. Replies: 0
    Last Post: 09-05-2006, 11:30 AM
  3. Replies: 0
    Last Post: 06-15-2006, 07:21 AM
  4. Replies: 0
    Last Post: 04-20-2001, 10:01 PM
  5. Replies: 4
    Last Post: 01-10-2001, 11:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center