解析xml 我总是解决不了 Hi,我觉得你可以使用JAXB来进行解析。可以自动生成XML结构映射生成的类,使用这些类就可以操作XML数据。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public static void addXml() throws JDOMException, FileNotFoundException, IOException {SAXBuilder builder = new SAXBuilder();Document doc = builder.build("src/po.xml");//获得文档对象Element root = doc.getRootElement();//获得根节点//添加新元素List allChildren = root.getChildren();System.out.println(root);System.out.println(allChildren.get(0));Element element = new Element("mov");element.setAttribute("movie", "mov1.swf");element.setAttribute("Text","txt1.swf");element.setAttribute("info","");root.addContent(element);doc.setRootElement(root);//文件处理XMLOutputter out = new XMLOutputter();out.output(doc, new FileOutputStream("src/po.xml"));}怎么写到<Thumb> 里面 关于一个Filter无效的问题 用超链接去下载word文件出问题 用jquery ajax ,从struts2返回jsp要怎么写 急急急,我用dree,为什么不能将那颗树显示出来? spring配置文件,都已配置好,但获取的值为null,在线等 2个基本小问题 █████████中国数据█████████ 在javascript中怎么统一简繁体字的编码. ear包怎么调用! 关于Struts! acegi webservice问题请教 xpath的问题
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build("src/po.xml");//获得文档对象
Element root = doc.getRootElement();//获得根节点
//添加新元素
List allChildren = root.getChildren();
System.out.println(root);
System.out.println(allChildren.get(0));Element element = new Element("mov");
element.setAttribute("movie", "mov1.swf");
element.setAttribute("Text","txt1.swf");
element.setAttribute("info","");
root.addContent(element);
doc.setRootElement(root);
//文件处理
XMLOutputter out = new XMLOutputter();
out.output(doc, new FileOutputStream("src/po.xml"));
}怎么写到<Thumb> 里面