Thomas Truhlarsky
2004-07-09 10:42:11 UTC
Hallo,
ich habe ein etwas seltsames Problem mit dem Laden eines Xml-Dokuments auf
einer Aspx-Seite.
Folgender Code verursacht bei der LoadXml-Methode eine
System.Xml.XmlException mit der Meldung "Ungültige Daten auf Stammebene.
Zeile1, Position1.":
System.Xml.XmlDocument xmlNavig = new System.Xml.XmlDocument();
string filePath = MapPath("~/nav.xml");
if (System.IO.File.Exists(filePath))
{
xmlNavig.LoadXml(filePath);
}
Allerdings funktioniert folgendes Codefragment ohne Probleme:
System.Xml.XmlDocument xmlNavig = new System.Xml.XmlDocument();
string filePath = MapPath("~/nav.xml");
if (System.IO.File.Exists(filePath))
{
System.IO.StreamReader sr = new System.IO.StreamReader(filePath);
xmlNavig.InnerXml = sr.ReadToEnd();
sr.Close();
}
Irgendwelche Ideen?
Danke!
Thomas Truhlarsky
ich habe ein etwas seltsames Problem mit dem Laden eines Xml-Dokuments auf
einer Aspx-Seite.
Folgender Code verursacht bei der LoadXml-Methode eine
System.Xml.XmlException mit der Meldung "Ungültige Daten auf Stammebene.
Zeile1, Position1.":
System.Xml.XmlDocument xmlNavig = new System.Xml.XmlDocument();
string filePath = MapPath("~/nav.xml");
if (System.IO.File.Exists(filePath))
{
xmlNavig.LoadXml(filePath);
}
Allerdings funktioniert folgendes Codefragment ohne Probleme:
System.Xml.XmlDocument xmlNavig = new System.Xml.XmlDocument();
string filePath = MapPath("~/nav.xml");
if (System.IO.File.Exists(filePath))
{
System.IO.StreamReader sr = new System.IO.StreamReader(filePath);
xmlNavig.InnerXml = sr.ReadToEnd();
sr.Close();
}
Irgendwelche Ideen?
Danke!
Thomas Truhlarsky