• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

[#document: null] as a result of parsing

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All ,
I am trying to parse an XML File using DOMParser . The version of xerces i am using is 1.1.3 (One comes with WAS3.5)
When i tried parsing a file I got the Document as [#document: null]
================================================================
DocumentBuilderFactory docbuilderfact= DocumentBuilderFactory.newInstance();
DocumentBuilder documentbuilder = docbuilderfact.newDocumentBuilder();
System.out.println("xmlURL......:" + xmlConfigFile);
Document document = documentbuilder.parse(xmlConfigFile);
System.out.println("Document="+document);
==============================================
Pls let me know how to resolve this..
Thanks in Advance
Sateesh
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats exactly what you should get. See the JavaDocs documentation for org.w3c.dom.Node - there is a nice table that shows the nodeName and nodeValue for all the different types of node. For a Document, the node Name is #document and the nodeValue is null.
You should now be able to do:
Element root = document.getDocumentElement();
to get the root element of the document.
Bill
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic