Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Verifying if namespace exists
Message
De
24/07/2015 09:57:17
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
XML
Titre:
Verifying if namespace exists
Versions des environnements
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01622469
Message ID:
01622469
Vues:
45
I have this method to add a namespace from my XML class:
    ' Add a namespace
    Public Function AddNamespace() As Boolean
        Dim lcNamespace As String = ""
        Dim lcUri As String = ""
        Dim llSuccess As Boolean = False

        ' Reset the values
        cMessage = ""

        ' Initialization
        lcNamespace = Trim(cNamespace)
        lcUri = Trim(cUri)

        ' If we have a Uri
        If lcUri.Length > 0 Then

            ' If we have a namespace
            If lcNamespace.Length > 0 Then

                Try

                    ' Create the XmlNameSpaceManager object once
                    ' This is needed as we could add several namespaces
                    If oXmlNameSpaceManager Is Nothing Then
                        oXmlNameSpaceManager = New XmlNamespaceManager(oXmlDocument.NameTable)
                    End If

                    oXmlNameSpaceManager.AddNamespace(lcNamespace, lcUri)
                    llSuccess = True
                Catch loException As Exception
                    cMessage = loException.Message
                End Try

            Else
                cMessage = cYouNeedToDefineTheNamespaceProperty
            End If
        Else
            cMessage = cYouNeedToDefineTheUriProperty
        End If

        ' Reset the values
        cNamespace = ""
        cUri = ""

        Return llSuccess
    End Function
However, I just found out that even if the namespace does not exist, this will not go in the Catch as an exception.

I would like to make an adjustment that if the namespace does not exist, that it will go in the exception.

Is there a way to verify if a namespace exists?
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