如何添加xml名称空间 [英] how to add xml namespaces
本文介绍了如何添加xml名称空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此提要(其摘要)必须看起来像这样:
This feed (snippit of it) needs to look exactly like this:
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
我要在此C#代码中添加些什么来添加额外的xmlns,xsi垃圾:
what do I add to this C# code to add that extra xmlns, xsi junk:
writer.WriteStartDocument();
writer.WriteStartElement("AmazonEnvelope");
如果没有此供稿,该供稿将被拒绝-
this feed is rejected without it--
推荐答案
尝试一下:
writer.WriteStartElement("AmazonEnvelope");
writer.WriteAttributeString(
"xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance");
writer.WriteAttributeString(
"xsi", "noNamespaceSchemaLocation", null, "amzn-envelope.xsd");
...
writer.WriteEndElement();
这篇关于如何添加xml名称空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文