올바른 솔루션이 없습니다
다른 팁
이 시도:
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();
.NET 3.5가 옵션입니까?
XNamespace ns = "http://www.w3.org/2001/XMLSchema-instance";
string s = new XElement("AmazonEnvelope",
new XAttribute(XNamespace.Xmlns + "xsi", ns),
new XAttribute(ns + "noNamespaceSchemaLocation", "amzn-envelope.xsd")
).ToString();
또는 함께 XmlWriter
:
const string ns = "http://www.w3.org/2001/XMLSchema-instance";
writer.WriteStartDocument();
writer.WriteStartElement("AmazonEnvelope");
writer.WriteAttributeString("xmlns", "xsi", "", ns);
writer.WriteAttributeString("xsi", "noNamespaceSchemaLocation",
ns, "mzn-envelope.xsd");
writer.WriteEndDocument();
제휴하지 않습니다 StackOverflow