System.Xml.XmlTextReader.ParseRoot() error when reading xml file from treenode TreeNodeSrc

System.Xml.XmlTextReader.ParseRoot() error when reading xml file from treenode TreeNodeSrc

Post by M P » Wed, 27 Mar 2002 09:52:20



Hi.
I keep on getting the following error
"There is invalid data at the root level. Line 1, position 1"
when I try to read an xml file from within the treeview web control.
Part of the trace is
[XmlException: There is invalid data at the root level. Line 1, position
1.]
   System.Xml.XmlTextReader.ParseRoot() +295
   System.Xml.XmlTextReader.Read() +127
   Microsoft.Web.UI.WebControls.TreeView.ReadXmlSrc(String TreeNodeSrc,
String TreeNodeXsltSrc, String strOuter)
   Microsoft.Web.UI.WebControls.TreeNode.ReadXmlSrc()

Part of the code in the aspx file looks like this:
<mytree:treeview runat="server" AutoPostBack="true" id="treeview1>
  <mytree:treenode text="text" TreeNodeSrc="sample.xml">
  </mytree:treenode>
</mytree:treeview>

xml file looks something like this:
<?xml version="1.0" encoding="utf-8" ?>
<TREENODES>
        <TREENODE TEXT="TOP NODE">
                <TREENODE TEXT="NODE 1"></TREENODE>
                <TREENODE TEXT="NODE 2"></TREENODE>      
        </TREENODE>

</TREENODES>

THANK YOU!!!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

 
 
 

1. Parsing Large xml files using XmlTextReader

Hi fellow programmers,

Im writing an application that has to parse an xml file to insert
values into a SQL Server database.  Im using an intermediate load page
that has an "animated" graphic to keep the user occupied so that a page
(that runs in the background) can parse the xml document and insert it
into a database.  What is giving me problems is that, when i try to
read large files ( file sizes > 3 MB ) the internet explorer gives me
the "The page cannot be displayed" error message.  File sizes <= 3mb
give me no problems.  I have tried searching the web but have not
encountered others who have similar problems.  I have also tried
stepping through the program through breakpoints but the program doesnt
break.  Can anyone point me in some sort of direction of what may be
causing this problem.  Im thinking that ASP.NET may not have enough
memory to cache a large file so it can read it with its XmlTextReader.
But then i read that Asp.net's XmlTextReader does not store the xml
document in memory. I'm also puzzled that the program wont break at any
break points that i have inserted during the xml file read process.
Any help would be greatly appreciated.

Thanks,

Ben Ong

2. Symbios Logic 8751SP supported?

3. System.Xml.XPath.XPathException Error when Transforming XML/XSL in Dot-Net

4. BookReader: The Narrative of the Life of Frederick Douglass

5. System.Xml.Serialization.IO.XmlWriter vs. System.Xml.XmlWriter

6. Deposits dissappear

7. System.Xml.Serialization.IO.XmlTextReader -vs- System.Xml.XmlReader

8. USR Sportser 28.8

9. Fastest way to read/ Parse an XML file

10. Xml Parsing Error sending valid Xml to stored procedure from ADO.Net / C#

11. XML Exception while reading existing xml-file

12. XML Serialization is giving a strange error on deserialization (System.InvalidOperationException)

13. System.InvalidOperationException in WebApplication while accessing serialiezed xml file