strip xml attribute id's using C# .NET 4
I'm passing some xml to a server and when doing a POST I need to strip the attribute id's, but I'm not sure how to do that using 开发者_开发技巧c#
Thanks
var myDoc = XDocument.Load("C:\\mydoc.xml")
myDoc.Descendants("myNode").Attributes("id").Remove();
You can use .NET's XML Namespace to load an XML document and then you could simply just cycle through all the element and remove any attributes that are ID's and save the result...
... I suppose you also could use a regular expression to remove it from a string though.
精彩评论