List Info

Thread: rss xml - removing a node




rss xml - removing a node
user name
2006-04-06 20:00:46
I want to remove the "item" node from an rss xml
file (2.0) if the title
of this exists already.

I'm having a hard time with removeChild -and yes
documentation on this
is almost always prefaced with how easy it is to use so I'm
sorry about
all of this.

here's what I've got...what goes in my loop where I put
the ?????  ?

        Dim root As XmlElement =
BillUpdateDoc.DocumentElement
        Dim xPath As String =
"channel/item[contains(title,'" &
strtitle & "')]"
        Dim nodes As XmlNodeList = root.SelectNodes(xPath)
(actually
there should only be one - so suggestions are welcome here
too)
        If nodes.Count > 0 Then
            Dim node As XmlNode
            For Each node In nodes ' delete it if it's
there so I can
refresh it.
????? this is where I can't get removeChild syntax correct
            Next
        Else
...


Thanks,
Jenny

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

rss xml - removing a node
user name
2006-04-06 21:00:07
Try this...
 
node.ParentNode.RemoveChild(node)
 
Mitch Gordon
http://www.enterpriseetc
.com


----- Original Message ----
From: Jennifer Quinn <jquinnLEGISLATURE.MI.GOV>
To: DOTNET-WEBDISCUSS.DEVELOP.COM
Sent: Thursday, April 6, 2006 4:00:46 PM
Subject: [DOTNET-WEB] rss xml - removing a node


I want to remove the "item" node from an rss xml
file (2.0) if the title
of this exists already.

I'm having a hard time with removeChild -and yes
documentation on this
is almost always prefaced with how easy it is to use so I'm
sorry about
all of this.

here's what I've got...what goes in my loop where I put
the ?????  ?

        Dim root As XmlElement =
BillUpdateDoc.DocumentElement
        Dim xPath As String =
"channel/item[contains(title,'" &
strtitle & "')]"
        Dim nodes As XmlNodeList = root.SelectNodes(xPath)
(actually
there should only be one - so suggestions are welcome here
too)
        If nodes.Count > 0 Then
            Dim node As XmlNode
            For Each node In nodes ' delete it if it's
there so I can
refresh it.
????? this is where I can't get removeChild syntax correct
            Next
        Else
...


Thanks,
Jenny

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com


===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )