Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Complex namespace in XML
Message
From
05/05/2011 19:44:50
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Complex namespace in XML
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01509763
Message ID:
01509763
Views:
90
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
Next
Reply
Map
View

Click here to load this message in the networking platform