I have an xml document looks like this:
<?xml version="1.0"?>
<Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ExtensionData />
<Name>ali</Name>
<Age>37</Age>
<Father>
<ExtensionData />
<Name>I</Name>
<Age>72</Age>
</Father>
<Mother>
<ExtensionData />
<Name>M</Name>
<Age>62</Age>
</Mother>
</Person>
I am using Delphi 7.
How can I remove all ExtensionData elements in XML document like this?
You can use the
IXMLNodeList.Delete()
orIXMLNodeList.Remove()
method to remove nodes:If you want to remove all
ElementData
elements regardless of their depth within the document, a recursive procedure can do that: