473,888 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

attributes.remo ve

Hello,

In my C# program I execute an attributes remove to remove all
attributes in the following root node.

<xtvd xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:TMSW ebServices">

All attributes are removed EXCEPT

xmlns="urn:TMSW ebServices"

What am I doing wrong or is there a workaround?

Thanks

Aug 16 '05 #1
3 3096
* sa**********@sb cglobal.net wrote in comp.text.xml:
In my C# program I execute an attributes remove to remove all
attributes in the following root node.

<xtvd xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="htt p://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:TMS WebServices">

All attributes are removed EXCEPT

xmlns="urn:TMS WebServices"

What am I doing wrong or is there a workaround?


The "xmlns" attribute (as well as xmlns:* attributes) are special
attributes that declare the default namespace and namespace pre-
fixes. In the example above you have an element 'xtvd' in the
'urn:TMSWebServ ices' namespace, if you remove the xmlns "attribute"
you would essentially rename the element, so that's what you would
have to do in order to get rid of them. That's typically not very
useful though, applications would no longer recognize the elements
in the document.
--
Björn Höhrmann · mailto:bj****@h oehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Aug 16 '05 #2
I understand what you are saying.

The odd thing is that when I leave any attributes in the root node, I
cannot read any of the elements or attributes in the XML file using
XPathNavigator/XPathNodeIterat or. When I manually remove everything in
the root node except the name <xtvd> everything works just fine.

I am using C# with Visual Studio 2003. Maybe there's something quirky
about .NET?

I cannot find a rename method. Is there some other way I can work
around this problem?

*** Sent via Developersdex http://www.developersdex.com ***
Aug 17 '05 #3
* Sam Stamport wrote in comp.text.xml:
I understand what you are saying.

The odd thing is that when I leave any attributes in the root node, I
cannot read any of the elements or attributes in the XML file using
XPathNavigat or/XPathNodeIterat or. When I manually remove everything in
the root node except the name <xtvd> everything works just fine.


You need to use an XmlNamespaceMan ager here, declare a prefix for the
xmlns="urn:TMSW ebServices" namespace and use namespace prefixes in the
XPath expressions, so instead of "/xtvd" you would use "/prefix:xtvd".

http://www.google.com/search?q=+site...mespaceManager
lists various articles on this subject.
--
Björn Höhrmann · mailto:bj****@h oehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Aug 17 '05 #4

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

Similar topics

12
5238
by: Oberon | last post by:
I have a large HTML document. It has hundreds of <span>s which have no attributes so these <span>s are redundant. How can I remove these tags automatically? The document also has <span>s with style attributes that I don't want to remove.
2
4573
by: mike | last post by:
I am using IE and I want to remove some attributes on my page before I delete the rows as a result of what looks like memory leaks in my page. I understand I can't remove the attributes, but the event handler is removed. here is my code: var row_delete = document.getElementById("Task_Row_"+taskNum); var obj = row_delete.getElementsByTagName("input");
8
10513
by: Gerry Viator | last post by:
Hi all, The following is part of XML file, how do I search through the file and remove an Element and all it's attributes. Example: TEST2? Of course I will pass the Element Name to remove from a control. - <Forms> - <Form Name="TEST1">
2
2389
by: Zach Mortensen | last post by:
I can't seem to get dynamically-compiled JScript code to use C#-defined custom attributes. I have a simple attribute and a class defined in a C# assembly: namespace MyNamespace { public abstract class MyCsharpAttribute : Attribute { }
13
2587
by: Alexandra | last post by:
Hi, I have a hidden system file that I need to read. I am logged in as an administrator. I can not change the file attributes using the windows explorer.
7
4550
by: localhost | last post by:
What is the best and/or fastest way to enumerate attributes of an HTML control? In my page template, I have: <body id="myBody" bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0" MS_POSITIONING="GridLayout" class="Body" runat="server"> And in my code-behind I want to look for the leftMargin
4
1917
by: Craig G | last post by:
i was using the following on a serverside button on a form If (Not Page.IsPostBack) Then Me.BtnDelete.Attributes.Add("onclick","return confirm('Are you sure you want to delete?');") End If but was wondering how i would go about doing the same for a button within a column? i cannot see btnDelete in the code-behind page
1
1660
by: Gérard Talbot | last post by:
Hello, According to DOM 2 Core, the attribute "nodeRef.attributes" is "A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise." http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-84CF096 The question I have is if such NamedNodeMap contains the specified attributes or all possible/actual/specified attributes. This question is important because MSIE 6 will return all possible...
23
1658
by: Frank Millman | last post by:
Hi all I have a small problem. I have come up with a solution, but I don't know if it is a) safe, and b) optimal. I have a class with a number of attributes, but for various reasons I cannot assign values to all the attributes at __init__ time, as the values depend on attributes of other linked classes which may not have been created yet. I can be sure that by the time any values are requested, all the other classes have been created,...
0
9957
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
11173
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
10772
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
10878
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,...
1
7988
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5810
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
6011
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4635
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
3
3245
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.