1
如何添加一个节点像添加节点到org.w3c.dom.NodeList
Element node = (Element) xpath.evaluate("//property[@value = 'entryDataTitle']", doc, XPathConstants.NODE);
我org.w3c.dom.NodeList?
NodeList entryDataItem = (NodeList) xpath.evaluate("//item[@name='entryDataItem']", doc, XPathConstants.NODESET);
嗨,没有方法叫appendChild()。 – StellaMaris
我已经用appendChild()的java API条目链接更新了我的答案。 – TangledUpInBlue
现在我明白你的意思了。你想要说使用对象节点而不是NodesList。你的代码使用我的类型为[NodeList]的entryDataItem来提到你(https://docs.oracle.com/javase/7/docs/api/org/w3c/dom/NodeList.html) – StellaMaris