Hello !
I'm creating xml files (.3dxml) by using VB .NET.
I've got a problem with namespaces. I'd like to generate this line :
- <Model_3dxml xmlns="..." xmlns:xsi="..." xsi:schemaLocation="http://www.monURL.com/">
I found two ways to do it.
First method :
- Dim elemRoot As XmlElement
-
elemRoot = XmlDoc.CreateElement("Model_3dxml")
-
Dim elemRootAttr As XmlAttribute
-
elemRootAttr = XmlDoc.CreateAttribute("xsi", "schemaLocation", "http://www.monURL.com/")
-
elemRoot.Attributes.SetNamedItem(elemRootAttr)
I obtain :
- <Model_3dxml xmlns="..." xmlns:xsi="..." d1p1:schemaLocation="" xmlns:d1p1="http://www.monURL.com"/>
Second Method :
- Dim elemRoot As XmlElement
-
elemRoot = XmlDoc.CreateElement("Model_3dxml")
-
Dim elemRootAttr As XmlAttribute
-
elemRootAttr = xmlDoc.CreateAttribute("xsi:schemaLocation")
-
elemRootAttr.Value = "http://www.monURL.com"
-
elemRoot.Attributes.SetNamedItem(elemRootAttr)
I obtain :
- <Model_3dxml xmlns="..." xmlns:xsi="..." schemaLocation="http://www.monURL.com"/>
these two XML files are wrong and I cannot use them...
What is the good way to do ?