本文介绍了如何添加XML namespces的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这饲料(它SNIPPIT)需要看起来就像这样:
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#code以添加额外的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 namespces的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!