想在已有的xml文件中添加节,提示“未将对象引用设置到对象的实例”,请教下哪里出了问题
Dim xmlDoc As New System.XML.XmlDocument
xmlDoc.Load("d:\201510020.xml")
Dim root As System.XML.XmlNode = xmldoc.SelectSingleNode("DataField")
Dim xel As System.XML.xmlelement = xmldoc.CreateElement("Data")
xel.SetAttribute("Code","889824100000")
xel.SetAttribute("CorpOrderID","201510020 ")
xel.SetAttribute("Actor","")
xel.SetAttribute("ActDate","2015-10-22")
xel.SetAttribute("CorpProductID","")
xel.SetAttribute("CorpBatchNo","")
xel.SetAttribute("ProduceDate","2015-08-28")
xel.SetAttribute("ToCorpID","")
root.appendchild(xel)
xmldoc.save("d:\201510020.xml")
[此贴子已经被作者于2015/12/14 16:12:48编辑过]