我正在写一个关于Xml属性的代码,有时它工作有时它不工作

时间:2017-11-14 12:31:57

标签: xml vb.net

Dim objXMLElement As XmlNode = Nothing
Dim objXMLElement1 As XmlNode = Nothing
Dim objXMLAttribute As XmlAttribute = Nothing

objXMLElement1 = doc.CreateElement("Country")              
objXMLElement1.InnerText = "united kingdom"
objXMLAttribute = doc.CreateAttribute("Code")
objXMLAttribute.Value = "GBR"
objXMLElement1.Attributes.Append(objXMLAttribute)                
objXMLElement.AppendChild(objXMLElement1)

这个元素没有创建属性值,它只创建innertext如何解决这个问题

0 个答案:

没有答案