This is my XML file and below you will find my code to remove it... I was
thinking that it's a simple task but this code doesn't work.
Anybody have a better solution?
<Advertisements >
<Ad>
<ImageUrl>htt p://localhost/UQCN/Images/Ecoroute.gif</ImageUrl>
<NavigateUrl>/UQCN/WebModules/AdsManager/PassThrough.asp x?AD=4</NavigateUrl>
<AlternateText> Test!</AlternateText>
<Keyword>Wrox </Keyword>
<Impressions> 1</Impressions>
</Ad>
----------Here is the element I want to remove from my XML doc
<Ad>
<ImageUrl>htt p://localhost/UQCN/Images/foretboreale.jp g</ImageUrl>
<NavigateUrl>/UQCN/WebModules/AdsManager/PassThrough.asp x?AD=5</NavigateUrl>
<AlternateText> Test 2</AlternateText>
<Keyword>Wrox 2</Keyword>
<Impressions> 5</Impressions>
</Ad>
---------------------------------------End of removed
element--------------------------------
<Ad>
<ImageUrl>htt p://localhost/UQCN/Images/Aptitudes.jpg</ImageUrl>
<NavigateUrl>/UQCN/WebModules/AdsManager/PassThrough.asp x?AD=6</NavigateUrl>
<AlternateText> tytvytv</AlternateText>
<Keyword>1</Keyword>
<Impressions> 1</Impressions>
</Ad>
</Advertisements>
Here is my Code
Dim rotatorDom As New XmlDocument()
rotatorDom.Load (rotatorFile)
Dim xPathFind As String = "//Ad[NavigateUrl=""" & _
settings.PassTh roughPage & "?AD=" & _
advertisementId .ToString() & """]"
rotatorDom.Load (rotatorFile)
Dim currentAd As XmlNode = _
CType(rotatorDo m.DocumentEleme nt.SelectSingle Node(xPathFind) , XmlNode)
rotatorDom.Docu mentElement.Rem oveChild(curren tAd)
My file still jam with this element!!!! Nothing changes