我有一個文檔org.w3c.dom.Document,我想要替換xml中特定標記的值。我嘗試過但以某種方式它沒有工作。它沒有給出錯誤,但是我無法看到價值的變化。更改xml標記的值
org.w3c.dom.Document中
public boolean SetTextInTag(Document doc, String tag, String nodeValue)
{
Node node = getFirstNode(doc, tag);
if(node != null){
node.setNodeValue(nodeValue);
return true;
}
return false;
}
EG
<mytag> this value is to be changed </mytag>
我想要的標籤值被chnaged到nodeValue.My代碼亙古不給任何錯誤,但我看不到的變化值。