Navigate/Query XmlDocument Created from Value of String
Posted on 2003-10-24
I am creating an xml document based on the results of a SQL query, as follows:
StringReader sr = new StringReader(strSQLResult);
XmlDocument xmlDoc = new XmlDocument();
XmlTextReader textReader = new XmlTextReader(sr);
When I get to the Read(), I get an error saying, "System.Xml.XmlException: The root element is missing." However, if I do a Response.Write of the value of strSQLResult to the browser, the browser renders the xml file without errors.
strSQLResult is a string created by iterating through the results of a query that have been returned to a DataReader. The value of strSQLResult is like (without formatting):
Can anyone tell me how I can now navigate/query the XmlDocument object? I need to pass through it several times to populate different DropDownLists. Any specific information and/or references to online resources illustrating how to handle this would be most appreciated.