我有這樣的XML數據爲什麼我在嘗試加載xml文件時解析EntityName時發生錯誤?
<Categories>
<cat name="Appliances"></cat>
<cat name="Arts, Crafts & Sewing"></cat>
<cat name="Automotive"></cat>
<cat name="Baby"></cat>
</Categories>
,我用這個代碼將數據讀入組合框:
XmlDocument xDoc = new XmlDocument();
xDoc.Load("cat.xml");
XmlNodeList cats = xDoc.GetElementsByTagName("cat");
for (int i = 0; i < cats.Count; i++)
{
comboBox1.Items.Add(cats[i].Attributes["name"].InnerText);
}
,但在行xDoc.Load("cat.xml");
我得到錯誤:
An unhandled exception of type 'System.Xml.XmlException' occurred in System.Xml.dll An error occurred while parsing EntityName. Line 3, position 30.
這是什麼意思 ?
參加【這裏這個問題]看看(http://stackoverflow.com/questions/23541910/an-error-之前嘗試此發生時,解析實體名稱行1位置844),並告訴我,如果它可以幫助你。 – Alisson