M
Major Aardvark
Hi
Why is it that when I attempt to delete all values from a node in an XML
file using the code below, I end up with the values being deleted, but not
the tags?
The code i have is:
Dim CountryCodeValueNodes As XmlNodeList
Dim CountryCodeValue As XmlNode
CountryCodeValueNodes =
configurationFile.SelectNodes("//type[@name='lstCountry']/values/value")
For Each CountryCodeValue In CountryCodeValueNodes
Dim CountryCode = CountryCodeValue.Attributes("key")
'Remove all values
CountryCodeValue.Attributes.RemoveAll()
Next
The original values in the file I am trying to write are as follows:
<type name="lstCountry" default="" inherits="combo" regex="" regexsample="">
<values>
<value key="US">
</value>
<value key="AD">
</value>
<value key="AE">
</value>
<value key="AF">
</value>
<value key="AG">
</value>
<value key="AI">
</value>
</values>
</type>
What I actually get as the result is:
<type name="lstCountry" default="" inherits="combo" regex="" regexsample="">
<values>
<value>
</value>
<value>
</value>
<value>
</value>
<value>
</value>
<value>
</value>
<value>
</value>
</values>
</type>
Thanks
MA
Why is it that when I attempt to delete all values from a node in an XML
file using the code below, I end up with the values being deleted, but not
the tags?
The code i have is:
Dim CountryCodeValueNodes As XmlNodeList
Dim CountryCodeValue As XmlNode
CountryCodeValueNodes =
configurationFile.SelectNodes("//type[@name='lstCountry']/values/value")
For Each CountryCodeValue In CountryCodeValueNodes
Dim CountryCode = CountryCodeValue.Attributes("key")
'Remove all values
CountryCodeValue.Attributes.RemoveAll()
Next
The original values in the file I am trying to write are as follows:
<type name="lstCountry" default="" inherits="combo" regex="" regexsample="">
<values>
<value key="US">
</value>
<value key="AD">
</value>
<value key="AE">
</value>
<value key="AF">
</value>
<value key="AG">
</value>
<value key="AI">
</value>
</values>
</type>
What I actually get as the result is:
<type name="lstCountry" default="" inherits="combo" regex="" regexsample="">
<values>
<value>
</value>
<value>
</value>
<value>
</value>
<value>
</value>
<value>
</value>
<value>
</value>
</values>
</type>
Thanks
MA