<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<Profile xmlns="http://google.com">
<number>123</number>
<name>bob</name>
</Profile>
</soap12:Body>
</soap12:Envelope>
到目前为止,我的代码是:
using (XmlWriter writer = XmlWriter.Create(@"C:\Users\Default\Desktop\books.xml")) { writer.WriteStartElement("soap12", "Envelope", "http://www.w3.org/2001/XMLSchema-instance"); writer.WriteStartElement("soap12", "Body", null); writer.WriteStartElement("Profile", "http://google.com"); writer.WriteElementString("number", "123"); writer.WriteElementString("name", "bob"); }
有人可以帮我这个吗?
谢谢!我需要以编程方式创建一个看起来像这样的xml: