Hi,我觉得你可以使用JAXB来进行解析。可以自动生成XML结构映射生成的类,使用这些类就可以操作XML数据。

解决方案 »

  1.   

    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> 里面