You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using nuget pacakge System.Xml.XmlDocument 4.0.0-beta-22819 and when I tried to load xml, I am getting the error System.Xml.XmlException: Root element is missing. for every valid xml file.
Code
TextReader textReader = File.OpenText(@"xml\document.xml");
XmlReaderSettings settings = new XmlReaderSettings();
settings.IgnoreWhitespace = true;
settings.DtdProcessing = DtdProcessing.Ignore;
XmlDocument doc = new XmlDocument();
// doc.LoadXml(textReader.ReadToEnd());
using (StringReader sr = new StringReader(textReader.ReadToEnd()))
using (XmlReader reader = XmlReader.Create(sr, settings))
{
doc.Load(reader);
}
XML files
<?xml version="1.0" encoding="utf-8" ?>
<StudentsInformation>
<GeneralInformation>
<School>University of XML</School>
<Department>Department of XML parsing</Department>
</GeneralInformation>
<Studentlist>
<Student id="1" score="100" enrollment="4/30/1789"
comment="1st and greatest president">George Washington</Student>
<Student id="2" score="100" enrollment="3/4/1861"
comment="Civil was. Great president!">Abraham Lincoln</Student>
<Student id="3" score="99" enrollment="1/20/1993"
comment="Monica Samille Lewinsky, Cool!">Bill J. Clinton</Student>
<Student id="4" score="98" enrollment="1/20/2001"
comment="House price went beyond American's affordability">
George W. Bush
</Student>
<Student id="5" score="99" enrollment="1/20/2009" comment=
"Ridiculously low interest rate, high house price. $ worthless">
Barack H. Obama
</Student>
<Student id="6" score="35" enrollment="4/30/2011"
comment="Never qualified to be the president.">Song Li</Student>
</Studentlist>
</StudentsInformation>
@stephentoub@krwq
Is there a way to create a command line project and reference corefx component (here System.Xml.XmlDocument) from my local system and debug myself?
I am using nuget pacakge System.Xml.XmlDocument 4.0.0-beta-22819 and when I tried to load xml, I am getting the error
System.Xml.XmlException: Root element is missing.
for every valid xml file.Code
XML files
and another xml file
The text was updated successfully, but these errors were encountered: