Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / May 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SuperDrone - 03 May 2005 20:39 GMT
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")
Derek Harmon - 04 May 2005 03:10 GMT
> I can't figure out how to add a secondary xmlns reference that will look
> like this.
[quoted text clipped - 4 lines]
> 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
SuperDrone - 04 May 2005 16:21 GMT
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.
SuperDrone - 04 May 2005 16:41 GMT
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 =-)

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.