aspose file tools*
The moose likes XML and Related Technologies and the fly likes Empty nodes problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Empty nodes problem" Watch "Empty nodes problem" New topic
Author

Empty nodes problem

Manu Quartier
Greenhorn

Joined: Oct 20, 2000
Posts: 10
Hello,
I'm using xerces and xalan and I have a problem with empty nodes. This appens when I create a DOM object from a XML file. I tried to use the "parser.setIncludeIgnorableWhitespace(false);" methode but nothing changes.
Can somebody help me ??
Thanks,
Manu
-------- CODE --------
Document dataDOM = null;
DOMParser parser = new DOMParser();
parser.setIncludeIgnorableWhitespace(false);
parser.parse("critere.xml");
dataDOM = parser.getDocument();

[This message has been edited by Manu Quartier (edited October 27, 2000).]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12671
    
    5
What exactly do you mean by an "empty node"?
What kind of Node is it?
What are you expecting to be there?
How are you determining that it is empty?
Bill

Java Resources at www.wbrogden.com
Manu Quartier
Greenhorn

Joined: Oct 20, 2000
Posts: 10
If critere.xml is :
<?xml version="1.0" encoding="ISO-8859-1"?>
<A>
<B crit="asd"/>
<A>
and the code is :
Document dataDOM = null;
DOMParser parser = new DOMParser();
parser.setIncludeIgnorableWhitespace(false);
parser.parse("critere.xml");
dataDOM = parser.getDocument();
String name = dataDOM.getFirstChild().getChildNodes().item(0).getNodeName()
then the value of name must be "B".
But the value is : "#text"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Empty nodes problem
 
Similar Threads
Node searching with Xerces
normalize( ) in DOM
Problem in adding node to JTree
Attempt to modify an identity column
XML parsing using DOMParser gets no result unless xmlns is removed?!