But as for the difference between the two, a node is more general then an
element. Anything in an XML document is a node (e.g. attributes, comments,
doctype, etc), but only tags are elements.
This error is not specific to XML conversions but .NET cannot implicitly
down-cast a variable. That is why you need to specify the cast yourself
since SelectSingleNode returns an XmlNode object.
"Oleg Tkachenko" <oleg@NO_SPAM_PLEASEtkachenko.com> wrote in message
news:e7**************@TK2MSFTNGP10.phx.gbl...
Pluto wrote:
What is the difference between XmlNode and XmlElement?
The same as between fruit and apple. XmlElement is particular type of
XmlNode.
this.appSettingsElement =
this.xml.SelectSingleNode("//configuration/appSettings");
Error: Cannot implicitly convert type 'System.Xml.XmlNode' to
'System.Xml.XmlElement'
So convert it explicitly:
this.appSettingsElement =
(XmlElement)this.xml.SelectSingleNode("//configuration/appSettings");
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel