getChildNodes() returns NULL for my root in XML

kitty_go_bark

New Member
My goal : to get the root of the XML in a \[code\]Node\[/code\] object , and then evaluate it !My problem : I'm trying to evaluate my expression from the ROOT of the XML file, I have this method ( I need to implement is) : \[code\]public Object evaluate(String expression, QName returnType);\[/code\]Assume that I've already opened the XML with \[code\]Document\[/code\] , like this : \[code\] //load the document into a DOM Document this.domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(true); // never forget this! this.builder = domFactory.newDocumentBuilder(); this.doc = builder.parse("books.xml"); //create an XPath factory this.factory = XPathFactory.newInstance(); //create an XPath Object this.xpath = factory.newXPath();\[/code\]Now when I do this , inside \[code\]public Object evaluate(String expression, QName returnType);\[/code\]:\[code\]String unitedString = " my characters " ; rootNode = doc.getChildNodes().item(0);System.out.println(rootNode.getNodeName()); // this line presents the name of the root Object returnedObject= xpath.evaluate(unitedString,rootNode ,returnType); // this line makes eclipse go crazy \[/code\]Eclispe says after line "4" : \[code\]" DTMManagerDefault.getDTMHandleFromNode(Node) line: not available "\[/code\] But in line "3" , Eclipse produces the name of the root , which is \[code\]inventory\[/code\] ...So where did I go wrong ? What's wrong with it ? Thank you all , Jack
 
Back
Top