XML Heeeelp !
-
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();
-
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();
You should check out the MSN documentation, in particular, the XmlNode.Attributes Property[^] which is a collection of the attributes associated to a particular
XmlNode
.- Nick Parker Microsoft MVP - Visual C#
My Blog | My Articles