How to delete specific node in omnixml delphi
- by Erwan
i've read this answer but i don't know how to use that sample in my case. I have an xml file
<Archive>
<Source>
<Name>321</Name>
<BatchID>123</BatchID>
</Source>
<DataList>
<Data>
<PN>AAAA</PN>
<FN>1111</FN>
</Data>
<Data>
<PN>BBBB</PN>
<FN>2222</FN>
</Data>
</DataList>
</Archive>
How can i delete the Node that has PN=BBBB?
I'm so sorry, i think i'm not clear in my question, my bad,
My Question is how to delete this section:
<Data>
<PN>BBBB</PN>
<FN>2222</FN>
</Data>
not only this section
<PN>BBBB</PN>
The Answer:
Thanks to Runner, i modified a little bit of his code
DeleteNode := XMLDoc.DocumentElement.SelectSingleNode('/Archive/DataList/Data[PN="BBBB"]');
DeleteNode.ParentNode.RemoveChild(DeleteNode);