Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detecting the presence of a node
Message
From
28/12/2005 14:11:26
 
 
To
All
General information
Forum:
ASP.NET
Category:
XML
Title:
Detecting the presence of a node
Miscellaneous
Thread ID:
01081389
Message ID:
01081389
Views:
45
With the following code, how can I adjust it to detect the presence of the node? Because if tcTag does not exist, this will generate an object reference not set on the cXML line.
    ' Get a XML node value
    ' expC1 XML
    ' expC2 Tag
    Public Function GetXMLNodeValue(ByVal tcXML As String, ByVal tcTag As String) As Boolean
        Dim llSuccess As Boolean
        oDOM.LoadXml(tcXML)
        oNode = oDOM.SelectSingleNode(tcTag)
        Try
            cXML = oNode.InnerText
            llSuccess = True
        Catch loError As Exception
            App.ErrorSetup(loError)
        End Try
        Return llSuccess
    End Function
Basically, I would like to know if oNode has been properly initialized. If not, I can adjust the code before the Try.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform