posted 12 years ago
Hi All,
I was wondering if someone could help me with my query please.
I have the following XML elements within my XML document:
<AddressLines>
<AddressLine>143</AddressLine>
<AddressLine>Fork Street</AddressLine>
<AddressLine>East Calder</AddressLine>
<AddressLine>Lothian</AddressLine>
<AddressLine>Scotland</AddressLine>
</AddressLines>
What i want to do is delete ONLY the third element from the XML above, without affecting the other address lines within the XML, however unfortunately, i cant seem to figure out how to do this.
As an example, when i want to remove a node which contains one element from my XML document then i use the following code; this works successfully:
Also, when i want to add text to the third element of the above XML, i use a NodeList contained within the following method; again this works successfully:
However as prevously stated, i just cant seem to figure out how to remove only one element from the above XML example.
I tried looping through the NodeList and then deleting the item i want to remove however i cant seem to get this to work; im also not sure if this is the best approach either.
Any help in this matter would be very much appreciated.
Thanks in advance
John