Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting the presence of a node
Message
De
28/12/2005 14:11:26
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
XML
Titre:
Detecting the presence of a node
Divers
Thread ID:
01081389
Message ID:
01081389
Vues:
44
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform