JDom 基本示例,JDom示例,import java.
分享于 点击 7178 次 点评:40
JDom 基本示例,JDom示例,import java.
import java.io.*; import org.jdom.*; import org.jdom.input.*; import org.jdom.output.*; public class FirstRecipeJDOM { public static void main(String[] args) { try { Document d = new SAXBuilder().build(new File(args[0])); Namespace ns = Namespace.getNamespace("<a href="http://recipes.org">http://recipes.org"); Element e = new Element("collection"); e.addContent(d.getRootElement().getChild("recipe", ns).detach()); Document n = new Document(e); new XMLOutputter().output(n, System.out); } catch (Exception e) {e.printStackTrace();} }}//该片段来自于http://byrx.net
用户点评