这个问题困扰了我好久,在Nodelist当中获取CData的时候老是返回null pointer,同样的代码在用android1.6是可以编译通过,换做2.2就会出错。
for(int i=0; i<len; i++){
UserDataStore us = new UserInfo();
NodeList list2 = list1.item(i).getChildNodes();
if(LOGDBG){
Log.i(TAG,"list2.item(1).getFirstChild()"+list2.item(1).getFirstChild());
Log.i(TAG,"list2.item(2).getFirstChild()"+list2.item(2).getFirstChild());
Log.i(TAG,"list2.item(3).getFirstChild()"+list2.item(3).getFirstChild());
Log.i(TAG,"list2.item(4).getFirstChild()"+list2.item(4).getFirstChild());
Log.i(TAG,"list2.tem(5).getFirstChild()"+list2.item(5).getFirstChild());
Log.i(TAG,"list2.item(6).getFirstChild()"+list2.item(6).getFirstChild());
}
String name = getCData(list2.item(1).getFirstChild());
if(LOGDBG)
Log.i(TAG,"name ="+name);
String passwd = getCData(list2.item(3).getFirstChild());
//String passwd = "allenHardcode";
if(LOGDBG)
Log.i(TAG,"passwd ="+passwd);
String email = getCData(list2.item(5).getFirstChild());
if(LOGDBG)
Log.i(TAG,"email="+email);
us.setName(name);
us.setPasswd(passwd);
us.setEmail(email);
usList[i] = us;
}
可能google对dom xml parser做了一些改动。
上面的code中,len == 3, 原先只需获取list2.item(1).getFirstChild(), list2.item(2).getFirstChild(), list2.item(3).getFirstChild(); 而现在scope变为list2.item(1).getFirstChild(), list2.item(3).getFirstChild(), list2.item(5).getFirstChild(); 其它2, 4, 6变为null
- 大小: 199.4 KB
- 大小: 199.4 KB
分享到:
相关推荐
w3c-dom.jar 包 dom解析xml使用 包 免积分下载
本资源是www.w3school.com.cn的整站HTML格式的完美教程,方便离线的朋友学习与...声明:制作本资源是为方便网友们离线时学习与参考,无意侵犯w3school的版权。若能上网的朋友请登录http://www.w3school.com.cn进行学习
presentation attributes and elements that W3C expects to phase out as support for style sheets matures. Authors should use the Strict DTD when possible, but may use the Transitional DTD when ...
w3cSchool.cc的整站下载,版本为2015.4.27止,在线地址为http://www.w3cschool.cc
Lorg/w3c/dom/UserDataHandler;)Ljava/lang/Object; at org.apache.cxf.staxutils.StaxUtil s.addLocation(StaxUtils.java:1038) at org.apache.cxf.staxutils.StaxUtils.startElement(StaxUtils.java:893) at org....
This is SVG, a language for describing two-dimensional graphics in XML. The Scalable Vector Graphics (SVG) Copyright 2001, 2002, 2011 World Wide Web Consortium (Massachusetts Institute of ...
tidy jar 包,用于将html文件转换成cml文件jar包
org.w3c.sac-1.3.0.M2.jar
Java 四种方式操作xml,包括xml,dom,sax,jdom这四种方式的一个简单例子。
node.js的W3CXML加密实现(httpwww.w3.orgTRxmlenc-core)
Appendix C: W3C DOM Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697 Appendix D: Latin-1 Character Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725 ...
org.dom4j.dom An implementation of the dom4j API which also supports the W3C object model. org.dom4j.dtd Classes to represent the DTD declarations. org.dom4j.io Provides input and output via SAX and ...
NULL 博文链接:https://desert3.iteye.com/blog/1041016
Chenso 是一个 org.w3c.dom XML 包装器/解析器库。 基本用法 运行测试 视窗 gradlew test Unix ./gradlew test 建造 视窗 gradlew.bat build Unix ./gradlew build 用法 获取 XML 元素中名称的第一个值 String ...
JavaTM 2 Platform Standard Ed. 5.0 所有类 软件包 java.applet java.awt ...org.w3c.dom.bootstrap org.w3c.dom.events org.w3c.dom.ls org.xml.sax org.xml.sax.ext org.xml.sax.helpers
Web 技术教程 网址:htt://pwww.w3school.com.cn 讲解、实例与编辑运行测试。
一个xml的解析方法,供参考。 import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource;
比较新的www.w3school.com教学手册2019,包含html,css,html5,javascript等新版api
www.w3school.com.cn ASP源码
Ø 1、DOM(org.w3c.dom) Ø “文档对象模型”方式,解析完的Xml将生成一个树状结构的对象。 Ø 2、SAX(org.xml.sax) Ø SimpleAPI for XML,以事件的形式通知程序,对Xml进行解析。 Ø 3、XMLPULL(org.xmlpull.v1) ...