• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

[#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
 
My pie came with a little toothpic holding up this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic