[英]Problems with creating nodes with XmlWriter -- "mis" as prefix
My first attempt to generate this type of file, not very familiar, please help me.我第一次尝试生成这种类型的文件,不是很熟悉,请帮帮我。 I want to achieve the following effect我想达到以下效果
<ExtendedData xmlns:mis="www.dji.com">
<mis:actions param="240" label="zoom" >CameraZoom</mis:actions>
</ExtendedData>
my code is我的代码是
writer.WriteStartElement("mis", "ExtendedData", "www.dji.com");
writer.WriteStartElement("mis", "actions", "www.dji.com");
writer.WriteAttributeString("param", "240");
writer.WriteAttributeString("label", "zoom");
writer.WriteString("CameraZoom");
writer.WriteEndElement();
It works like this:它是这样工作的:
<mis:ExtendedData xmlns:mis="www.dji.com">
<mis:actions param="240" label="zoom" >CameraZoom</mis:actions>
</mis:ExtendedData>
What do I need to do to remove the "mis:" prefix from " <mis:ExtendedData xmlns:mis="www.dji.com">"我需要做什么才能从“<mis:ExtendedData xmlns:mis="www.dji.com">”中删除“mis:”前缀
The Microsoft documentation (I assume this is the .NET XmlWriter?) gives the example Microsoft 文档(我假设这是 .NET XmlWriter?)给出了示例
// Write an element (this one is the root).
writer.WriteStartElement("book");
// Write the namespace declaration.
writer.WriteAttributeString("xmlns", "bk", null, "urn:samples");
for writing a no-namespace element with a namespace declaration that's not actually used in the element name.用于编写一个没有在元素名称中实际使用的命名空间声明的无命名空间元素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.