473,401 Members | 2,146 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,401 software developers and data experts.

VB.Net question on using the XML DOM (xmldocument)

I am about to go bonkers trying to figure this out -- So here goes

Currently I am building an xml document and have no problem building the
document with one namespace designation using the DOM.

Here is a snip-it of what I have

<vl:VNETList xmlns:vl="http://www.1234.com/VNET/List">
<Template>
<ID>Template_FFF4887BC8B4E98F85256EE60061576A</ID>

I can’t figure out how to add a secondary xmlns reference that will look
like this.

<vl:VNETList xmlns:vl="http://www.1234.com/VNET/List"
xmlns="http://www.5678.com/VNET/eiwm">
<Template>
<ID>Template_0A0AD3A027803E7485256DC00066D831</ID>

I am using the following code to create my root node
Dim objXmlNodeRoot As XmlNode = xdoc.CreateElement("vl", "VNETList",
"http://www.1234.com/VNET/List")

Nov 12 '05 #1
3 1569
"SuperDrone" <Su********@discussions.microsoft.com> wrote in message news:CC**********************************@microsof t.com...
I can't figure out how to add a secondary xmlns reference that will look
like this.

<vl:VNETList xmlns:vl="http://www.1234.com/VNET/List"
xmlns="http://www.5678.com/VNET/eiwm"> : : Dim objXmlNodeRoot As XmlNode = xdoc.CreateElement("vl", "VNETList",
"http://www.1234.com/VNET/List")


Dim objXmlNsAttr As XmlAttribute = xdoc.CreateAttribute( _
"xmlns", "", "http://www.w3.org/2000/xmlns/" )
objXmlNodeRoot.Attributes.Append( objXmlNsAttr)
Derek Harmon
Nov 12 '05 #2

Using your code snipit I get the following error

An unhandled exception of type 'System.ArgumentException' occurred in
system.xml.dll

Additional information: The attribute local name cannot be empty.
Nov 12 '05 #3
Ok I figured it out and your snip-it gave me a nudge in the correct direction.

Dim objXmlNsAttr As XmlAttribute = xdoc.CreateAttribute("xmlns")
objXmlNsAttr.Value = "http://www.1234.com/VNET/eiwm"

Thanks for the help =-)
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: reddy | last post by:
I am trying to insert a node into an XMLFile. using XMLTextwriter. My Question is Is it possible to do without using XMLDocument. Because its loading all the the file into memory. I just want to...
2
by: Kenneth | last post by:
I am tryint to view a xml document in Internet Exploer as a ActiveX object using Javascript but it does not work. I only see the button but nothing happens when i click it. I am trying to view...
1
by: Shawn | last post by:
Hi. I'm using a FileStream (instead of just the path to the xml file) to load an XmlDocument. I'm doing this because I need to be able to prevent other processes to update the file I'm working on....
3
by: Dan | last post by:
Is there a better way to include the XML declaration than the following? XmlDeclaration dec =m_XMLDocument.CreateXmlDeclaration("1.0",string.Empty, "yes");...
7
by: SQLScott | last post by:
I have a Web Service in which I am trying to pass an XMLDocument as a parameter to one of the methods. I would like to use the XMLTextReader to read the XML but I am getting the following error: ...
1
by: Peter Nofelt | last post by:
Hey All, I'm running into this issue with parsing through an xml document by tag name. Below is an example xml document: File Name: things.xml <things> <people> <name>Peter</name>
5
by: Drew Yallop | last post by:
I read an XML file with a stream reader in VB.Net. When I look at the stream reader output in debug mode (by passing cursor over the stream reader object)the format is a perfect replica of the...
3
by: Goran Djuranovic | last post by:
Hi All, Does anyone know how to retreive deepest XPath value from XML document by using VB.NET? For example, if I had an XML file like this: <Root> <Customer> <Name>MyName</Name> </Customer>...
11
by: ericms | last post by:
Can anybody show me how to insert a CDATA section using XPathNavigator ? I have tried the follwing with no luck: XmlDocument docNav = new XmlDocument(); docNav.LoadXml(xmlString);...
4
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... We've got a lot of places in our code where we read relatively small xml user preference blocks. Currently that's creating a new XmlDocument in every spot. I was thinking we might see...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.