用vb.net 为什么不能设置 xml Element 的值
在按钮的点击事件上添加下面的代码
private sub button1_click(byval sender as system.object, byval e as system.eventargs) handles button1.click
dim m_xmldocument as new xml.xmldocument
dim m_xmlelementroot as xml.xmlelement
m_xmlelementroot = m_xmldocument.createelement("root")
m_xmldocument.appendchild(m_xmlelementroot)
m_xmlelementroot.value = "ok"
msgbox(m_xmldocument.innerxml)
end sub
但运行时会有异常,异常在“m_xmlelementroot.value = "ok"”这句:
未处理的“system.invalidoperationexception”类型的异常出现在 system.xml.dll 中。
其他信息: 不能在节点类型上设置值: element。
这是怎么回事啊,大家帮帮忙,谢谢。
推荐阅读


讨论区