在 XmlWriter 中添加多个命名空间声明 [英] Adding multiple namespace declarations in XmlWriter
本文介绍了在 XmlWriter 中添加多个命名空间声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 XmlWriter 写出以下元素
I am trying to write out the following element using XmlWriter
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
我已经完成了第一个声明,使用
I've got the very first declaration done using
writer.WriteStartElement("kml", "http://www.opengis.net/kml/2.2");
如何将剩余的 3 个声明添加到同一个元素?
How can I add the remaining 3 declarations to the same element?
推荐答案
writer.WriteAttributeString("xmlns","gx", null, "http://www.google.com/kml/ext/2.2");
writer.WriteAttributeString("xmlns","kml", null, "http://www.opengis.net/kml/2.2");
writer.WriteAttributeString("xmlns","atom", null, "http://www.w3.org/2005/Atom");
从 https://msdn.microsoft.com/en-us/library/cfche0ka(v=vs.100).aspx.
这篇关于在 XmlWriter 中添加多个命名空间声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文