vb.net 如何生成XML过程中如果生成类似<TCS:***>这样的节点?
<tcs:TcsLinkMan>
<tcs:Name>aaaaaaaaaaaa</tcs:Name>
<tcs:Department>text</tcs:Department>
<tcs:Duty>text</tcs:Duty>
<tcs:Telephone>text</tcs:Telephone>
<tcs:Mobile>text</tcs:Mobile>
<tcs:Fax>text</tcs:Fax>
<tcs:Address>text</tcs:Address>
<tcs:ZipCode>text</tcs:ZipCode>
<tcs:Email>text</tcs:Email>
<tcs:ImCode>text</tcs:ImCode>
<tcs:ImType>text</tcs:ImType>
</tcs:TcsLinkMan>
[解决办法]
指定namespace
[解决办法]
Dim doc As XmlDocument = New XmlDocument
Call doc.AppendChild(doc.CreateProcessingInstruction("xml", "version=""1.0"" encoding=""UTF-8"""))
Dim root As XmlElement = doc.CreateElement("tcs:TcsLinkMan")
Dim node1 As XmlElement = doc.CreateElement("tcs:Name")
node1.InnerText = "aaaaaaaaaaaa"
root.AppendChild(node1)
Dim node2 As XmlElement = doc.CreateElement("tcs:Department")
node2.InnerText = "text"
root.AppendChild(node2)
Dim node3 As XmlElement = doc.CreateElement("tcs:Duty")
node3.InnerText = "text"
root.AppendChild(node3)
Dim node4 As XmlElement = doc.CreateElement("tcs:Telephone")
node4.InnerText = "text"
root.AppendChild(node4)
Dim node5 As XmlElement = doc.CreateElement("tcs:Mobile")
node5.InnerText = "text"
root.AppendChild(node5)
Dim node6 As XmlElement = doc.CreateElement("tcs:Fax")
node6.InnerText = "text"
root.AppendChild(node6)
Dim node7 As XmlElement = doc.CreateElement("tcs:Address")
node7.InnerText = "text"
root.AppendChild(node7)
Dim node8 As XmlElement = doc.CreateElement("tcs:ZipCode")
node8.InnerText = "text"
root.AppendChild(node8)
Dim node9 As XmlElement = doc.CreateElement("tcs:Email")
node9.InnerText = "text"
root.AppendChild(node9)
Dim node10 As XmlElement = doc.CreateElement("tcs:ImCode")
node10.InnerText = "text"
root.AppendChild(node10)
Dim node11 As XmlElement = doc.CreateElement("tcs:ImType")
node11.InnerText = "text"
root.AppendChild(node11)
doc.AppendChild(root)
doc.Save("linkMan.xml")