Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Complex namespace in XML
Message
De
05/05/2011 19:44:50
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Complex namespace in XML
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01509763
Message ID:
01509763
Vues:
91
I have this portion of a class which is used to create an XML and add a branch into it:
        Private oXmlTextWriter As XmlTextWriter = Nothing

        ' Create a XML
        ' expC1 File
        ' expO1 Encoding
        Public Function CreateXML(ByVal tcFile As String, ByVal tcEncoding As System.Text.Encoding) As Boolean

            ' Create the text writer
            oXmlTextWriter = New XmlTextWriter(tcFile, tcEncoding)

            oXmlTextWriter.Formatting = Formatting.Indented
            oXmlTextWriter.Indentation = 3
            oXmlTextWriter.WriteStartDocument()

            Return True
        End Function

        ' Write a start element
        ' expC1 Tag
        ' expC2 Namespace
        Public Function WriteStartElement(ByVal tcTag As String, _
         Optional ByVal tcNamespace As String = "") As Boolean

            ' If we do not have a namespace
            If tcNamespace.Length = 0 Then
                oXmlTextWriter.WriteStartElement(Trim(tcTag))
            Else
                oXmlTextWriter.WriteStartElement(Trim(tcTag), tcNamespace)
            End If

            Return True
        End Function
The WriteStartElement() supports the tag and an optional namespace. However, in my case, I need to define something like this:
<BranchName xmlns="http://www.something.com" xsi:schemLocation="http://www.something.com" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
Is this supported with XmlTextWriter?
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