最近使用dom4j读取xml的时候经常读取到#text,
在stackoverflow找到了答案:
#text : It's whitespace (newlines, spaces, tabs) :)
忽略这个数据的方法
Node node = childNodes.item(i);
int nodeType = node.getNodeType();
如果nodeType是3,就忽略
// NodeType
/**
* The node is an <code>Element</code>.
*/
public static final short ELEMENT_NODE = 1;
/**
* The node is an <code>Attr</code>.
*/
public static final short ATTRIBUTE_NODE = 2;
/**
* The node is a <code>Text</code> node.
*/
public static final short TEXT_NODE = 3;
/**
* The node is a <code>CDATASection</code>.
*/
public static final short CDATA_SECTION_NODE = 4;
/**
* The node is an <code>EntityReference</code>.
*/
public static final short ENT