473,387 Members | 1,517 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,387 software developers and data experts.

XML Heeeeelp !

hi, i am facing this trouble (pretty obvious tho')
im working with a xmldocument, the trick is this is coming with some
empty attributes
i want to browse for the empty attributes and to get rid of them
this is the example of what do i receive
and under is what ive tried
it does only displays the name of the empty attribute
but do not know how to erase that from the node

SO MANY THANKS IN ADVANCE, PEOPLE !!!

================================================== =========
NOW IS LIKE :
example attrib1="" attrib2="yes" attrib3="no" attrib4=""
node attribX=""
-----------------------------------------------------------
SHOULD BE LIKE :
example attrib2="yes" attrib3="no"
node
================================================== =========
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("nuevo.xml");
XmlNodeList nodes = xmlDoc.SelectNodes("//@*");
foreach(XmlNode node in nodes)
{
if (node.Value.ToString() == "")
{
Console.WriteLine(node.Name.ToString());
}
}
Console.ReadLine();

Nov 22 '05 #1
1 809
you may try

node.OwnerElement.RemoveAttributeNode(node)

/LM

"rene.rugerio[at]gmail.com" <re**********@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
hi, i am facing this trouble (pretty obvious tho')
im working with a xmldocument, the trick is this is coming with some
empty attributes
i want to browse for the empty attributes and to get rid of them
this is the example of what do i receive
and under is what ive tried
it does only displays the name of the empty attribute
but do not know how to erase that from the node

SO MANY THANKS IN ADVANCE, PEOPLE !!!

================================================== =========
NOW IS LIKE :
example attrib1="" attrib2="yes" attrib3="no" attrib4=""
node attribX=""
-----------------------------------------------------------
SHOULD BE LIKE :
example attrib2="yes" attrib3="no"
node
================================================== =========
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("nuevo.xml");
XmlNodeList nodes = xmlDoc.SelectNodes("//@*");
foreach(XmlNode node in nodes)
{
if (node.Value.ToString() == "")
{
Console.WriteLine(node.Name.ToString());
}
}
Console.ReadLine();

Nov 22 '05 #2

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

Similar topics

3
by: Kevin P. | last post by:
All, I need some help. I need to execute a GUI via a web page sent to a client and pass it 2 arguments. I have been searching the newsgroups to get a clue on how to do this. Essentially, I...
1
by: Orhan Toker | last post by:
Hi, Is it possible to format a datagrid cell containing string type data. (For example, i want "2122131199" value to be displayed as (212)-213-11-99. Also text boxs hasn't that kind of property...
6
by: RMG | last post by:
I use VS.net 2003 and VSS 6a. Whilst working on the network the integration between VS.net and VSS works perfectly. But when I open a project whilst disconnected from the network I get some...
1
by: Ratnest | last post by:
Hi, I'm new to Microsoft Access today, so this is probably a very basic question for all you clever people out there. Anyone know how I copy down a column in Microsoft Access? It doesn't seem...
20
by: honeygrl33 | last post by:
i accidentially erased something someone helped me write and i am soooo in trouble if i dont fix this, i really need the help!!!!! heres what i have: /* */ #include <stdio.h> #include...
5
by: Neo Geshel | last post by:
I still have a problem displaying images from an access DB using asp.net. This showimage.aspx is for an admin site. I need to pull the correct image from the correct table, hence the two GET...
0
by: Ronel Greaves | last post by:
I put together some code using GetAttr and SetAttr to get and set attributes from read-only to normal and back Everything runs fine on NT4 but the GetAttr and SetAttr don't behave the same on...
2
by: Mitchell Vincent | last post by:
Ok, I'm frustrated now. The simplest of things isn't working for me. I have this in my form's load event (after the combo is populated): If cmbCategory.SelectedIndex < 0 Then...
0
by: jaquesmayol | last post by:
Hi : I got a form with a datagrid and a toolbox with a disk icon to save de changes to a dataset from the grid. When i start editing a row and click on the save icon the changes are not saved...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.