473,835 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vb.net xml namespace xmlns xmldocument

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 xmlns="">100</Timeout
<MyServ>

I am using CreateElement as such

xElem = newXMLConfigDoc .CreateElement( "Timeout")
xElem.InnerText = "100"
rootNode.Append Child(xElem)

What am I doing wrong ??

Feb 21 '07 #1
1 9333
marfi95 wrote:
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 xmlns="">100</Timeout
<MyServ>
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)
Dim Timeout As XmlElement = XmlDoc.CreateEl ement("Timeout" )
Timeout.InnerTe xt = "100"
XmlDoc.Document Element.AppendC hild(Timeout)

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Feb 22 '07 #2

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

Similar topics

5
13584
by: jrmsmo | last post by:
Hi I have a document as follows: <?xml version="1.0"?> <metadata xml:lang="en"> </metadata> I want to change the document so it looks as follows: <?xml version="1.0"?> <metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://localhost/XMLDemo/MyXMLschema.xsd">
6
8888
by: JoostV | last post by:
How can I set the default namespace of an XmlDocument/XmlElement? I've tried doing something like rootElement.SetAttribute( "xmlns", "http://www.w3.org/2000/xmlns/", "http://www.some.org/theschema" ); on the DocumentElement. However, this fails. Any ideas??
2
2287
by: Matt Torline via .NET 247 | last post by:
I am trying to duplicate an xml document, and I am pretty new to xml. I am using hte Xml namespace and taking advantage of the xmldocument class. I would like to add the following to an element xmlns:dt="urn:schemas-microsoft-com:datatypes" Is there a way to do this through the setattribute or createelement methods? Whenever I try all i get is the xmlns="urn:schemas-microsoft-com:datatypes" -------------------------------- From:...
2
11410
by: Manoj G | last post by:
Hello, I believe there is no way to remove the default namespace declaration (For eg <DataSet xmlns="something">.... ) on an XmlNode object directly through DOM. So, what is the best way to remove it 1) XSLT templates? 2) Copy all the contents into a new node and leave out the namespace? Use this node node in lieu of the old one?
4
4183
by: David Grogan | last post by:
Hi, 2 questions.... 1. I'm parsing an XHTML document that contains both the default namespace (xmlns="http://www.w3.org/1999/xhtml") and a custom one (xmlns:r="...") - both of these being attributes of <html>. When I then insert new XmlNodes into the DOM the HTML tags all end up getting an unnecesarry 'xmlns' attribute added, elements with the 'r' prefix don't, which is correct. Is there any way to stop the XmlNode/XmlWriter from...
2
7253
by: Christoph | last post by:
I'm using the following code to create what will be the root element of my XML document. XmlDocument controlDocument = new XmlDocument(); //add root node XmlElement rootNode = controlDocument.CreateElement( "ns0:MyRootElement" ); rootNode.SetAttribute( "xmlns:ns0", "http://my.namespace.uri" ); controlDocument.AppendChild(rootNode); I'm trying to get it so that it comes out as follows:
3
27064
by: Andy Fish | last post by:
Hi, I am creating a new XmlDocument from scratch, but I can't see how I can make a namespace declaration and associate a prefix with it. For instance in the following example: XmlDocument doc = new XmlDocument(); XmlElement el = doc.CreateElement("foo:data"); doc.AppendChild(el); doc.Save("foo.xml");
0
5985
by: XML newbie: Urgent pls help! | last post by:
I am using VB.Net. My program is to connect to a remote IPAddress. Once, it verifies the login information it should display the SessionID and enable some button . I appreciate your help and thanku in advance When I run the pgm , I get the error: Can't parse login information. Namespace Manager or XsltContext needed. This query has a prefix, variable or userdefined function. I have added the Try-catch in all my functions. In...
4
4152
by: XML newbie: Urgent pls help! | last post by:
I am using VB.Net. My program is to connect to a remote IPAddress. Once, it verifies the login information it should display the SessionID and enable some button . I appreciate your help and thanku in advance When I run the pgm , I get the error: Can't parse login information. Namespace Manager or XsltContext needed. This query has a prefix, variable or userdefined function. I have added the Try-catch in all my functions. In...
3
8131
by: bhu | last post by:
Hi i am trying some things in XML for webservices but got stuck with the xml Creation. This is the First Sample C# Code XmlDocument oInvDocument = new XmlDocument(); oNode= oInvDocument.CreateNode(XmlNodeType.Element,"InventoryUpdateBatch",""); oInvDocument.AppendChild(oNode);
0
9810
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10815
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10524
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10236
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9348
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6968
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5639
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4434
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3997
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.