你用什么解析的~?怎么解析的?
CDATA只表示中间是一段完整的片段,不受一些特殊符号的影响,没别的作用,直接获取description的值应该就可以了
CDATA只表示中间是一段完整的片段,不受一些特殊符号的影响,没别的作用,直接获取description的值应该就可以了
解决方案 »
- jsp视频播放,怎么建播放列表,可以选择文件来播放的那种,急啊!
- 今天遇到一个面试题,请各位帮忙看看答案是什么?谢谢
- spring bean 调用问题
- jmf中显示视频的问题。。
- hibernate中为什么说sessionFactory是重量级的
- 拿什么来拯救你---我的多条记录??????
- JDBC联接mysql的问题!各位来帮帮忙,高分回报!!!!!!!
- Mastring EJB2 电子版是PDF格式的,我用词霸不能直接翻译,怎么才能支持鼠标取词?
- JB7+Weblogic7.0搭建web service少个文件?
- junit4 怎么定义全局变量
- j2ee框架搭建 [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
- javamail 问题。帮帮我吧
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new FileInputStream("C:\\Documents and Settings\\Administrator\\桌面\\q.xml"));
Element e = doc.getDocumentElement();
NodeList nl = e.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node n = nl.item(i);
if (n.getNodeType() == Node.CDATA_SECTION_NODE) {
System.out.println(n.getNodeValue());
}
}
}
你得通过getChildNodes去获取子节点
public static void main(String[] args) throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new FileInputStream("C:\\q.xml"));
Element e = doc.getDocumentElement();
printChildNodes(e.getChildNodes());
}
public static void printChildNodes(NodeList list) {
for (int i = 0; i < list.getLength(); i++) {
Node n = list.item(i);
System.out.println(n.getNodeName() + " : " + n.getNodeValue());
printChildNodes(n.getChildNodes());
}
}