正确的写法:
- Element root = new Element("root");
- root.setAttribute("att", attribute);
- root.setText(name);
- Document doc = new Documet();
- doc.setRootElement(root);
- XmlOutputter out = new XmlOutputter(Format.getPrettyFormat());
- String xml = out.outputString(root);
|
|