greengiant83
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2012
09:01 AM
how to tell if xml element is present vs empty
I need to read a bit of XML and determine if a given xml node is present. If it is present, even if it doesnt have any children, I need to do one set of actions. If it just isnt present I need do something else. I tried testing it against invalid and checking its type() but they don't provide a way to distinguish. The element is not listed as invalid when its not present and it's type() is listed as roXMLList even though it doesn't exist
How can I tell if an XML element is present or not?
How can I tell if an XML element is present or not?
1 REPLY 1

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2012
09:31 AM
Re: how to tell if xml element is present vs empty
If xml.NonExistentNode.Count() = 0 Then
' node doesn't exist
End If
If xml.NodeWithChildren.GetChildElements().Count() > 0 Then
' node has children
End If
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)