Removing empty attributes in xmldocument
-
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();
-- modified at 13:21 Saturday 12th November, 2005 -
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();
-- modified at 13:21 Saturday 12th November, 2005heeeelp !