DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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,649
    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

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links