你是不是用的是XML特殊字符呀。

解决方案 »

  1.   

    判断 node type, 跳过 text node 和 comment node
      

  2.   

    没这么复杂吧!我半年前专门搞xml+xsl+java+jsp的,我记得当时好像在jdom的某个api里面可以设置参数,内部自动处理了。  不过我后来搞国际化-》群集——>中间件,现在在做技术支持,  一时忘了怎么写的了,再加上正在出差,没法帮你找我以前做的东西(机遇jmx的控制台,和weblogic的控制台类似),。。  你随便搜一艘jdom网上的例子就有解决方法了,我以前也是这么办的!!! good  lucky!
      

  3.   

    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = dbf.newDocumentBuilder();
             // in是InputStream 对象
             Document doc = builder.parse(in);
             Element root = doc.getDocumentElement();
             NodeList childrenList = root.getChildNodes();         for (int i=0; i<childrenList.getLength;i++){
                  Node child = childrenList.item(i);
                  if ( child instanceof Element){
                     //这里就跳过了空白和回车了
                       ...