G
GhislainTanguay
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>http://localhost/UQCN/Images/Ecoroute.gif</ImageUrl>
<NavigateUrl>/UQCN/WebModules/AdsManager/PassThrough.aspx?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>http://localhost/UQCN/Images/foretboreale.jpg</ImageUrl>
<NavigateUrl>/UQCN/WebModules/AdsManager/PassThrough.aspx?AD=5</NavigateUrl>
<AlternateText>Test 2</AlternateText>
<Keyword>Wrox2</Keyword>
<Impressions>5</Impressions>
</Ad>
---------------------------------------End of removed
element--------------------------------
<Ad>
<ImageUrl>http://localhost/UQCN/Images/Aptitudes.jpg</ImageUrl>
<NavigateUrl>/UQCN/WebModules/AdsManager/PassThrough.aspx?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.PassThroughPage & "?AD=" & _
advertisementId.ToString() & """]"
rotatorDom.Load(rotatorFile)
Dim currentAd As XmlNode = _
CType(rotatorDom.DocumentElement.SelectSingleNode(xPathFind), XmlNode)
rotatorDom.DocumentElement.RemoveChild(currentAd)
My file still jam with this element!!!! Nothing changes
thinking that it's a simple task but this code doesn't work.
Anybody have a better solution?
<Advertisements>
<Ad>
<ImageUrl>http://localhost/UQCN/Images/Ecoroute.gif</ImageUrl>
<NavigateUrl>/UQCN/WebModules/AdsManager/PassThrough.aspx?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>http://localhost/UQCN/Images/foretboreale.jpg</ImageUrl>
<NavigateUrl>/UQCN/WebModules/AdsManager/PassThrough.aspx?AD=5</NavigateUrl>
<AlternateText>Test 2</AlternateText>
<Keyword>Wrox2</Keyword>
<Impressions>5</Impressions>
</Ad>
---------------------------------------End of removed
element--------------------------------
<Ad>
<ImageUrl>http://localhost/UQCN/Images/Aptitudes.jpg</ImageUrl>
<NavigateUrl>/UQCN/WebModules/AdsManager/PassThrough.aspx?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.PassThroughPage & "?AD=" & _
advertisementId.ToString() & """]"
rotatorDom.Load(rotatorFile)
Dim currentAd As XmlNode = _
CType(rotatorDom.DocumentElement.SelectSingleNode(xPathFind), XmlNode)
rotatorDom.DocumentElement.RemoveChild(currentAd)
My file still jam with this element!!!! Nothing changes