0
"Object"タグを削除する必要がありますが、コンテンツを保存して保持する必要があります。それは可能ですか?XMLノードをJavaで削除する方法
<ds:KeyInfo>
<wsse:SecurityTokenReference>
<wsse:Reference URI="#b3f74c53-b79f-4dec-aa26-ca552f8f8745"/>
</wsse:SecurityTokenReference>
</ds:KeyInfo>
<ds:Object Id="id1"> // <-Remove this
<wsu:Timestamp>
<wsu:Created>2017-03-28T20:21:44Z</wsu:Created>
<wsu:Expires>2017-03-28T23:08:24Z</wsu:Expires>
</wsu:Timestamp>
</ds:Object> // <-Remove this
私が試した:
Node node = xml.getElementById("id1");
xml.getDocumentElement().removeChild(node);
しかし:すべての
Org.w3c.dom.DOMException: NOT_FOUND_ERR: An attempt is made to reference a node in a context where it does not exist.
明確にしてください。 ' ...'を ' ... 'に変更しようとしていますか? –