473,395 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

[VB.NET][XML] problem of namespace

1
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 :
Expand|Select|Wrap|Line Numbers
  1. <Model_3dxml xmlns="..." xmlns:xsi="..." xsi:schemaLocation="http://www.monURL.com/">
I found two ways to do it.

First method :
Expand|Select|Wrap|Line Numbers
  1. Dim elemRoot As XmlElement
  2. elemRoot = XmlDoc.CreateElement("Model_3dxml")
  3. Dim elemRootAttr As XmlAttribute
  4. elemRootAttr = XmlDoc.CreateAttribute("xsi", "schemaLocation", "http://www.monURL.com/")
  5. elemRoot.Attributes.SetNamedItem(elemRootAttr)
I obtain :
Expand|Select|Wrap|Line Numbers
  1. <Model_3dxml xmlns="..." xmlns:xsi="..." d1p1:schemaLocation="" xmlns:d1p1="http://www.monURL.com"/>
Second Method :
Expand|Select|Wrap|Line Numbers
  1. Dim elemRoot As XmlElement
  2. elemRoot = XmlDoc.CreateElement("Model_3dxml")
  3. Dim elemRootAttr As XmlAttribute
  4. elemRootAttr = xmlDoc.CreateAttribute("xsi:schemaLocation")
  5. elemRootAttr.Value = "http://www.monURL.com"
  6. elemRoot.Attributes.SetNamedItem(elemRootAttr)
I obtain :
Expand|Select|Wrap|Line Numbers
  1. <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 ?
Jan 3 '07 #1
0 1893

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: John | last post by:
I am trying to use the xml desinger in .net 1.1 to create the follow schema. where USAddress is derived from Address But when I generate the xml file, the .net xml editor says "The active schema...
0
by: Edmund Rhudy | last post by:
Okay, this one's been bugging me for a few hours and I can't figure out what to do about it. I've been working on a little project for work that will take an RSS feed, extract certain items from...
1
by: rohits79 | last post by:
Rohit using System; using System.Xml; using System.IO; using System.Xml.Serialization; namespace ConsoleApplication1 {
1
by: Shimon Sim | last post by:
I have project that have some pages with a lot of functionality on them. Some functionality on these pages require post backs. For example depending on what user selects on drop down page gets some...
0
by: Gerard Brazil | last post by:
I've been trying to use the Visual Basic .NET XML Documentation Tool to document a project of mine and it's been a VERY frustrating and unproductive endeavor. First off, I can't even load my...
1
by: Michael Nemtsev | last post by:
Any kind of differences? Were they buid on the common base or different? -- WBR, Michael Nemtsev :: blog: http://spaces.msn.com/laflour "At times one remains faithful to a cause only...
1
by: marfi95 | last post by:
I am using XMLDocument to create my xml. How do I remove the namespace information ? It is being put on all my xml nodes: <MyServ xmlns="http://www....../XInclude> <Timeout...
2
by: pnmcosta | last post by:
Hi, I'm fairly new to XML Schema validation. We have XML being imported that must validate against the following schema: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.