0
我使用DOM下面使用网上的例子创建一个XML节点instread,XML DOM拥有CreateChild需要元素
DocumentBuilderFactory docfac= DocumentBuilderFactory.newInstance();
DocumentBuilder docb= docFactory.newDocumentBuilder();
Document doc = docb.newDocument();
// root
Element rootElement = (Element)doc.createElement("TEST");
doc.appendChild(rootElement); //Compiler error
...
appenchild采取Node对象,而不是Element对象。我试图使用Node,但似乎没有暴露给set属性的方法,因此,我无法真正使用节点。
任何帮助将真的很感激它。
谢谢。
谢谢,它修复了它。 – Tony 2012-07-10 12:44:45