Console.WriteLine() returns System.Xml.XmlElement

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
hi all




<pre style="font-family:Consolas; background:white; color:black; font-size:13px <span style="color:#2b91af XmlNode xmlNode = GetXmlData(param1, param2); //functions returns XmlNode type
<span style="color:#2b91af Console.WriteLine(xmlNode.ToString()); <span style="color:green //returns System.Xml.XmlElement[/code]
I am trying to display my variable "xmlNode" but it returns "System.Xml.XmlElement". Also, how do I read it in memory to select a particular node inside xmlNode?
Also this line: xdoc.LoadXml(xmlNode.ToString());
gives me the following error:
Unhandled Exception: System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.<br/>
at System.Xml.XmlTextReaderImpl.Throw(Exception e)<br/>
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)<br/>
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()<br/>
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()<br/>
at System.Xml.XmlTextReaderImpl.Read()<br/>
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)<br/>
at System.Xml.XmlDocument.Load(XmlReader reader)<br/>
at System.Xml.XmlDocument.LoadXml(String xml)<br/>
at Program.Main(String[] args)


Thank you

<






Max


<br/>

View the full article
 
Back
Top