473,666 Members | 2,144 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

removing xmlns form xml vb.net

Hello,

If I have a xml document with a rootlevel

<workOrderRelea sed xmlns="http://www.qad.com/qdoc"
xmlns:enc="http ://www.w3.org/2002/12/soap-encoding"
xmlns:qcom="htt p://www.qad.com/qdoc/common"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="workOrderR eleasedWithComm ents-JITS17_1.xsd">

When I use the following vb.net code to remove the xlmns attributes they all
remove but the first one. I need to remove them all.

objXMLDoc.Load( fileString)

Dim objAttrib As XmlAttributeCol lection =
objXMLDoc.Docum entElement.Attr ibutes

objAttrib.Remov eAll()

Thank you for the help
Nov 12 '05 #1
1 12679


Jack Colletta wrote:

If I have a xml document with a rootlevel

<workOrderRelea sed xmlns="http://www.qad.com/qdoc" When I use the following vb.net code to remove the xlmns attributes they all
remove but the first one. I need to remove them all. Dim objAttrib As XmlAttributeCol lection =
objXMLDoc.Docum entElement.Attr ibutes

objAttrib.Remov eAll()


In the DOM as specified by the W3C and as implemented in .NET you cannot
simply change the namespace of a node, you would need to create a new
node with the same local name but with no namespace.
And of course with the above XML not only the root element but all
elements below it have the same default namespace (unless a descendant
has its own xmlns="") so using the DOM you would have to create a lot of
new nodes.
It might be easier to write an XSLT 1.0 stylesheet to do that task.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 12 '05 #2

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

Similar topics

11
4307
by: EAI | last post by:
Hi All, I have a XML of the following form <?xml version="1.0"?> <xxxx xmlns="http://xxx.xxx.com"> .... </xxxx> When I try to read xml using SelectSingleNode, I am getting exception
7
2974
by: Simon Hart | last post by:
Hi, I have a requirement to remove the xmlns from the DOM in order to pass over to MS CRM 3.0 Fetch method.It seems the fetch method blows up if there is a xmlns present!?! The reason I have a xmlns present is because the Xml I am passing to CRM is a node from a bigger file that does require a xmlns and using the DOM ..OuterXml seems to set the xmlns for you automatically - which I don't want. Any help would be great.
6
2056
by: Chris Chiasson | last post by:
Hi, After reading and experimenting for a several hours, I have this stylesheet: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xmlns="http://www.w3.org/2000/xmlns/" xmlns:mathematica="http://www.wolfram.com/XML/" version="1.0">
3
7266
by: Keith Patrick | last post by:
I'm doing some document merging where I want to bring in an XmlDocument and import its document element into another document deeper in its tree. However, when serializing my underlying objects, .Net likes to add these namespaces: <RootNode xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ChildNode xmlns="MyObjectHierarchyNamespace/> </RootNode> The problem this is causing me is that...
1
2029
by: IsValidUN | last post by:
I am trying to spit a delimited string (e.g. val1;val2;va31...) I am able to parse if correctly except if puts an unwanted namespace into the result. (example below) How do I remove xmlns="" from the version tag? ?xml version="1.0" encoding="utf-8"?> <ws_tdl:TDLResponse xmlns:ws_tdl="http://www.accessitx.com/WS_TDL" xmlns="http://www.accessitx.com/TDL_Interface" xmlns:xs="http://www.w3.org/2001/XMLSchema"...
0
2116
by: nappingcub | last post by:
This is my first time coding a web service in .NET and ran into a slight snag that I was hoping that anyone could help me out on. I'm using the generic Hello World web service that is stubbed out on a new web service project since it can convey what I would like to do in the smallest amount of code. I've figured out how to change the <HelloWorldResponse> to a different element name by using the SoapDocumentMethod parameters, but I can't find...
2
12929
by: MedIt | last post by:
Hi, I am new in using xsl.I am stuck in a simple task,which is trying to remove an atribute from a node,and keep the rest of the attributes of this element in the xslt. I have tried a couple of options but to no use so far! Can any one shed some light on me? Here's a sample of my original xml: <?xml version="1.0" encoding="UTF-8" ?> <dom xmlns="http://www.cdisc.org/ns/odm/v1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"...
6
2252
by: Olagato | last post by:
I need to transform this: <urlset xmlns="http://www.google.com/schemas/sitemap/0.84"> <url> <loc>http://localhost/index.php/index./Paths-for-the-extreme-player</ loc> </url> <url> <loc>http://localhost/index.php/index.php/Games/The-edge-of-the- wall</loc>
0
2440
by: =?Utf-8?B?ZWQ=?= | last post by:
I had this exact problem using a vb.net client accessing a Java web service. The solution takes 3 steps: 1.) Create custom ClientOutputFilter 2.) Create a custom Assertion that uses filter from step 1 3.) Bind service to custom Assertion Step 1 Custom Filter(Called by Custom Assertion) Class ClientOutputFilter
0
8444
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
8356
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8781
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...
1
8551
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8639
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
5664
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
4198
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...
0
4368
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2771
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

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.