我底下哪个程序为什么不能读取出xml的内容来?
<?xml version="1.0" encoding="UTF-8"?>
<mails><mailinfo><info><title> 版权所有</title><date>2007-06-09 14:31:13</date><create>2005051000</create></info><content><![CDATA[地址:深圳市南湖路国贸商住大厦16E,F,G座 电话:0755-82174455<BR> Copyright 2006 姚氏珠宝 版权所有 传真:0755-82206437 ]]></content></mailinfo></mails>
public String GetMailContent(String mailFile) {
String iscontent = "";
File mailname = new File(mailFile);
//System.out.println(mailname.getPath());
if (mailname.exists()) {
try {
SAXReader saxReader = new SAXReader();
Document document = null;
try {
document = saxReader.read(mailname);
}
catch (MalformedURLException ex) {
String iserror = ex.getMessage();
System.out.println(iserror);
return iserror;
}
//System.out.println(document.getDocType().getSystemID());
List list = document.selectNodes("//mailinfo/@content");
Iterator iter = list.iterator();
while (iter.hasNext()) {
Attribute attribute = (Attribute) iter.next();
String isvalue = attribute.getName();
System.out.println(isvalue);
isvalue = attribute.getText();
System.out.println(isvalue);
iscontent = iscontent + isvalue;
}
return iscontent;
}
catch (DocumentException e) {
String iserror = e.getMessage();
System.out.println(iserror);
return iserror;
}
}
else {
return iscontent;
}
}
补充:.NET技术 , C#