Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用XMLParser将节点插入GWT客户端中的现有XML文档_Java_Xml_Gwt - Fatal编程技术网

Java 使用XMLParser将节点插入GWT客户端中的现有XML文档

Java 使用XMLParser将节点插入GWT客户端中的现有XML文档,java,xml,gwt,Java,Xml,Gwt,我有一个xml文档(使用GWT客户端的XMLParser库中的document类),其格式如下: <document><node id="0">content</node><node id="1">more content</node></document> 必须在父节点上调用insertBefore,因此: Node nNext = n.getNextSibling(); //To get the next sibli

我有一个xml文档(使用GWT客户端的XMLParser库中的document类),其格式如下:

<document><node id="0">content</node><node id="1">more content</node></document>

必须在父节点上调用
insertBefore
,因此:

Node nNext = n.getNextSibling(); //To get the next sibling to use it with insertBefore
Element newNode = doc.createElement("node");
newNode.appendChild(doc.createTextNode("new content")); //seems to work up until here
n.insertBefore(newNode, nNext); //so this line could be the problem?
n.getParentNode().insertBefore(newNode, n.getNextSibling());