vb.net creating xml

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • marfi95

    #1

    vb.net creating xml

    My app is creating an entire XML document through the code. I want
    the root node to look as follows:

    <MyService xmlns:xi="http://www.w3.org/2003/XInclude">
    ....
    </MyService

    I can't seem to get the :xi to be put into the xml though, so it looks
    like this:

    <MyService xmlns="http://www.w3.org/2003/XInclude">

    What am I doing incorrectly ? here is the code:


    newXMLDoc.Appen dChild(newXMLCo nfigDoc.CreateX mlDeclaration(" 1.0", "",
    ""))

    xElem = newXMLDoc.Creat eElement("Servi ceProperty", "http://
    www.w3.org/2003/XInclude")
    newXMLDoc.Appen dChild(xElem)

    How do I get the :xi in there ?

    Mark

  • Martin Honnen

    #2
    Re: vb.net creating xml

    marfi95 wrote:
    My app is creating an entire XML document through the code. I want
    the root node to look as follows:
    >
    <MyService xmlns:xi="http://www.w3.org/2003/XInclude">
    ...
    </MyService
    Const XiNs As String = "http://www.w3.org/2000/xmlns/"
    Dim XmlDoc As XmlDocument = New XmlDocument
    XmlDoc.AppendCh ild(XmlDoc.Crea teElement("MySe rvice"))
    Dim XiAttribute As XmlAttribute =
    XmlDoc.CreateAt tribute("xmlns" , "xi", XiNs)
    XiAttribute.Val ue = "http://www.w3.org/2003/XInclude"
    XmlDoc.Document Element.SetAttr ibuteNode(XiAtt ribute)

    --

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

    Comment

    Working...