Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XML node attribute vanishes
Message
From
25/12/2012 13:37:43
 
 
To
24/12/2012 04:15:24
General information
Forum:
ASP.NET
Category:
XML
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01560521
Message ID:
01560606
Views:
35
Based on your enhancements, the updated version is as follow:
        ' Get a XML node attribute
        ' expC1 Node
        ' expC2 Attribute
        Public Function GetXMLNodeAttributeValue(ByVal tcNode As String, ByVal tcAttribute As String) As Boolean
            Dim lcAttribute As String = ""
            Dim llFound As Boolean = False
            Dim loAttribute As XmlAttribute = Nothing

            ' Reset the values
            cMessage = ""
            cNodeAttribute = ""

            ' Initialization
            lcAttribute = UCase(tcAttribute)

            ' If we have a content
            If Not oXmlAttributeCollection Is Nothing Then
                oXmlAttributeCollection = Nothing
            End If

            ' Select the node
            If oXmlNameSpaceManager Is Nothing Then
                oXmlNode = oXmlDocument.SelectSingleNode(tcNode)
            Else
                oXmlNode = oXmlDocument.SelectSingleNode(tcNode, oXmlNameSpaceManager)
            End If

            ' If the node does not exist
            If oXmlNode Is Nothing Then
                cMessage = oApp.StrTran(cNodeDoesNotExist, "##Node##", tcNode)
                Return False
            End If

            ' Assign the new attributes to this object
            oXmlAttributeCollection = oXmlNode.Attributes

            ' Scan the attribute collection
            For Each loAttribute In oXmlNode.Attributes

                ' If this is the one
                If UCase(loAttribute.Name) = lcAttribute Then
                    cNodeAttribute = loAttribute.Value
                    llFound = True
                    Exit For
                End If

            Next

            ' If we did not find it
            If Not llFound Then
                cMessage = oApp.StrTran(cAttributeDoesNotExist, "##Attribute##", tcAttribute)
                Return False
            End If

            Return True
        End Function
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform