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

removing empty attributes in xmldoc (easy)

hi forum
dumb question here
i have this xmldocument which is from a certain xml
[xmldocument.load("x.xml")]
looping in the nodes i can see which if the attributes are empty
the thing here is that i just dont know how to erase the ones aren't
filled
they appear like
<node att1="" att2="yes" att3="ok" att4="">
i want to take att1 and att4 out, any ideas ?
thanks in advance

<code>
================================================== ====
XmlNodeList nodes = xmlDoc.SelectNodes("//@*");
foreach(XmlNode node in nodes)
{
if (node.Value.ToString() == "")
{
Console.WriteLine(node.Name.toString( ));
}
}
================================================== ====
</code>

Nov 12 '05 #1
0 1260

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

Similar topics

8
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...
2
by: GhislainTanguay | last post by:
This is my XML file and below you will find my code to remove it... I was thinking that it's a simple task but this code doesn't work. Anybody have a better solution? <Advertisements>
1
by: Dorte | last post by:
Hi, From an ASP.NET application I am loading an xml-file in order to modify it. This is part of the code I have produced so far: XmlDocument XMLDoc = new XmlDocument(); XmlNamespaceManager...
11
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
0
by: rene.rugerio[at]gmail.com | last post by:
hi forum dumb question here i have this xmldocument which is from a certain xml looping in the nodes i can see which if the attributes are empty the thing here is that i just dont know how to...
1
by: lltaylor2000 | last post by:
Hello, I am creating an XML Document using XmlDocument. I can create my top node no problem However when I add child nodes they seem to inherit the xmlns="" attribute (see xml below). How...
3
by: Fede | last post by:
Hi everybody, in vb.net I have this code: ...... myNode= XmlDoc.CreateElement("aNode") myAttribute = XmlDoc.CreateAttribute("xlink", "href", "http://www.w3.org/1999/xlink") ...
1
by: JD | last post by:
I have a DataGridView with a DataSet as DataSource. The user can update the contents of the DataGridView, and then click on a Save button to save the data to an XML file. When they click on...
7
by: Tarik Monem | last post by:
Here's the latest snag in the code: I was able to retrieve data from the most of the xml files except for the xml files that contain attributes but I have yet to find a tutorial that explains the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.