52,792
社区成员




var xmlDom; //XML DOM object
loadXML = function(fileRoute){
xmlDoc=null;
if (window.ActiveXObject){
xmlDoc = new ActiveXObject('Msxml2.DOMDocument');
xmlDoc.async=false;//这里设置true就是异步
xmlDoc.load(fileRoute);
}
return xmlDoc;
}
xmlDom=loadXML(xmlFile).xmlDom.documentElement;//这里得到了xml对象,你可以进行解析
List list=biz.getList();
if(null!=list){
StringBuffer str=new StringBuffer();
str.append(" <?xml version='1.0' encoding='utf-8'?> <menu>");
str.append(" <first name="HOME" url="index.jsp"> </first> ");
str.append(" <first name="ABOUT US" url="jsp/about.jsp">");
for (int i = 0; i <list.size(); i++) {
Model model=(Model)list.get(0);
str.append(" <second name=\""+model.getNmae()+"\" url=\""model.getUrl()+"\" />");
}
str.append(" <first name="CONTACT US" url="/wisdom/jsp/contact.jsp">
</first> ");
str.append(" </menu>");
response.setContentType("text/xml;charset=utf-8");
try {
response.getWriter().print(str.toString());
response.flushBuffer();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}