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
    Posts
    1

    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());
    con.setDoOutput(true);
    con.setRequestMethod("GET");
    in=con.getInputStream();
    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(Parser2.java:3376)
    at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3364)
    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:668)
    at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
    at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
    at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185)
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:76)
    at com.df.semtools.adwords.GetAdwordsStats.getKeywords(GetAdwordsStats.java:278)
    ..
    ...
    ....
    Thanks for ur help in advance

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Welcome to DevX

    Can you post the contents of your applicationContext.xml file? It looks like you're missing the root element.

Similar Threads

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

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

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