2010-08-23 9 views

cevap

2
static void removeAllAttributes(XDocument doc) 
{ 
    foreach (var des in doc.Descendants()) 
     des.RemoveAttributes(); 
} 

Kullanım:

var doc = XDocument.Load(path); //Or .Parse("xml"); 
removeAllAttributes(doc); 

string res = doc.ToString(); 
3

foreach (nodes.SelectNodes olarak XmlElement el (".//*")) {

el.Attributes.RemoveAll();

}

İlgili konular