C# XML Writer Format AmazonEnvelope for AU Scratchpad
OK so I'm trying to format this XML element so that it looks like this:
<AmazonEnvelope xsi:noNamespaceSchemaLocation="amzn-envelope.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
This is the code I have so far:
writer.WriteAttributeString("xsi", "noNamespaceSchemaLocation", null, "amzn-envelope.xsd");
writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance");
Now this code outputs this XML element:
<AmazonEnvelope noNamespaceSchemaLocation="amzn-envelope.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
So it's almost there but the xsi:
is missing before this noNamespaceSchemaLocation
I really don't know where I'm going wrong.
Also I have been in touch with amazon devs and they tell me that it must be formatted like I have asked. Though if you do some googling you will notice examples of the xml writer code which will output the following XML element:
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
This is wrong, and gives an error in the scratch pad.
I hope my question makes sense.
thanks for the help.
链接地址: http://www.djcxy.com/p/34566.html上一篇: 为什么存在URLS的XAML命名空间?