getChildNodes
public NodeList getChildNodes()
A NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes. 先返回所有的子节点
然后遍历它,根据节点的类型判断ELEMENT_NODE
public static final short ELEMENT_NODE
就可以过滤掉Text Node了
public NodeList getChildNodes()
A NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes. 先返回所有的子节点
然后遍历它,根据节点的类型判断ELEMENT_NODE
public static final short ELEMENT_NODE
就可以过滤掉Text Node了
解决方案 »
- Struts2 访问不存在的Action报Unable to instantiate Action
- 急,DetachedCriteria 如何count(*)排序,求高手指导一下
- hibernate能用get返回一个对象,但用load就是null,为什么呢?
- JAVA高手进
- 请问服务器端怎么读取别人客户端上的文件
- 朋友们帮我看看eclipse里面配置hibernate的问题,谢谢!
- Hibernate: 为何查出来的结果始终是数据库中的第一条记录? ..在线等...急..
- 关于org.apache.crimson.tree.ElementNode作为AXIS,webservice的返回值和参数的问题
- eclipse3.1+struts+hibernate+tomcat进行Web开发(分虽不高,但是还是希望大家进来看看。)
- initial.lookup("HelloHome")和java:comp/env/ejb/SimpleConverter
- 我用的JDBC-ODBC桥,总出现这个异常,加了连接池,怎么处理?
- 如何用Java编写一个有效的XML生成器?
又不能访问下面的数据, 两难哪!我是想空格就不产生节点,Xerces C 2.2.0 有办法么?
解析器支持的话 直接打开一个开关就行(但据我推测Xerces C是没有这样的开关的)。
不然的话,要么在处理过程中记得过滤结点;
要么先将整个tree “预处理”一下,剔除所有这些空白结点,再进行你需要的处理;
但是我社了false,却没有起作用
setIgnoringElementContentWhitespace()确定是否忽略元素内容中的空白。
但是(JAXP中),这里的IgnoringElementContentWhitespace,需要由DTD来定义。否则,它无法确定哪些空白使可忽略的。