使用 C# .NET 4 去除 xml 属性 id
我正在将一些 xml 传递到服务器,在执行 POST 时,我需要删除属性 id,但我不知道如何使用 c# 来做到这一点,
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 .NET 的 XML 命名空间 加载 XML 文档,然后您可以简单地循环遍历所有元素并删除任何 ID 属性并保存结果...
...我想您也可以使用正则表达式将其从字符串中删除尽管。
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.