aspxファイル:
<div>
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1"
ShowCheckBoxes="All" ShowLines="True">
</asp:TreeView>
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/Details.xml">
</asp:XmlDataSource>
</div>
Deatails.xml:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Root>
<Collection Name="Server 1">
<Box>MB1</Box>
<Box>MB2</Box>
<Box>MB3</Box>
<Box>MB4</Box>
<Box>MB5</Box>
</Collection>
</Root>
スタックトレース:
[XmlException: Root element is missing.]
System.Xml.XmlTextReaderImpl.Throw(Exception e) +76
System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res) +61
System.Xml.XmlTextReaderImpl.ParseDocumentContent() +3981048
System.Xml.XmlTextReaderImpl.Read() +151
System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) +58
System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +20
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +129
System.Xml.XmlDocument.Load(XmlReader reader) +108
System.Web.UI.WebControls.XmlDataSource.PopulateXmlDocument(XmlDocument document, CacheDependency& dataCacheDependency, CacheDependency& transformCacheDependency) +306
System.Web.UI.WebControls.XmlDataSource.GetXmlDocument() +153
System.Web.UI.WebControls.XmlHierarchicalDataSourceView.Select() +17
System.Web.UI.WebControls.TreeView.DataBindNode(TreeNode node) +125
System.Web.UI.WebControls.TreeView.PerformDataBinding() +120
System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect() +85
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
System.Web.UI.WebControls.TreeView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22
System.Web.UI.WebControls.TreeView.OnPreRender(EventArgs e) +36
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
ページの読み込み中に例外がスローされ、w3cshoolsバリデーターに従ってxmlファイルとその有効性を検証しようとしました。この例外の原因は何ですか。私が間違っていたところを訂正してください。ありがとう!