2
请帮助使用Apache公理生成XML文件,用一个父母和两个子标签任何XML文件,我想下面的代码示例XML文件生成
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace ns1 = factory.createOMNamespace("bar","x");
OMElement root = factory.createOMElement("root",ns1);
OMNamespace ns2 = root.declareNamespace("bar1","y");
OMElement elt1 = factory.createOMElement("foo",ns1);
OMElement elt2 = factory.createOMElement("yuck",ns2);
OMText txt1 = factory.createOMText(elt2,"blah");
elt2.addChild(txt1);
elt1.addChild(elt2);
root.addChild(elt1);
请帮我如何序列OMElment是非序列化api类的根元素。 请帮我举个例子。
谢谢,它是为我工作,你的序列化文件解释根元素问题。 – Shekkar
不客气。 –