2010-08-23 2 views

답변

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

사용법 :

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

string res = doc.ToString(); 
3

foreach는 (nodes.SelectNodes에서 XMLELEMENT 엘 (".//*")) {

el.Attributes.RemoveAll();

}

관련 문제