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:e7Q3XKSjDHA.2592@TK2MSFTNGP10.phx.gbl...[color=blue]
> Pluto wrote:
>[color=green]
> > What is the difference between XmlNode and XmlElement?[/color]
> The same as between fruit and apple. XmlElement is particular type of
> XmlNode.
>[color=green]
> > this.appSettingsElement =
> > this.xml.SelectSingleNode("//configuration/appSettings");
> >
> > Error: Cannot implicitly convert type 'System.Xml.XmlNode' to
> > 'System.Xml.XmlElement'[/color]
>
> So convert it explicitly:
> this.appSettingsElement =
> (XmlElement)this.xml.SelectSingleNode("//configuration/appSettings");
>
> --
> Oleg Tkachenko
>
http://www.tkachenko.com/blog
> Multiconn Technologies, Israel
>[/color]