我在哪里出错?将元素添加到现有的XML节点
我有OppDetails为已标记的XML文件如下图所示
<OppDetails>
<OMID>245414</OMID>
<ClientName>Best Buy</ClientName>
<OppName>International Rate Card</OppName>
<CTALinkType>AO,IO,MC,TC</CTALinkType>
</OppDetails>
</OppFact>
我现在想以另一个元素添加进去,但得到的使用appendChild方法错误,请帮助
XmlNode rootNode = xmlDoc.SelectSingleNode("OppDetails");
XmlElement xmlEle = xmlDoc.CreateElement("CTAStartDate");
xmlEle.InnerText = ExcelUtility.GetCTAStartDate();
rootNode.AppendChild(xmlEle);
xmlDoc.Save("C:\\test.xml");
这将有助于了解错误是什么。 – EMP 2010-04-19 03:39:01
未将对象引用设置为对象的实例。 – SSK 2010-04-19 03:42:06