如何读取xml文件中的数据并将这些值存储在哈希表中。 [英] how to read the data in xml file and store those values in hash table.
问题描述
如何读取xml文件中的数据并将这些值存储在哈希表中。
加载excel后,创建哈希表。
var data = doc。元素(testes)。元素(teste);
元素中此行的错误
错误1'System.Xml.XmlDocument'不包含'Element'的定义,并且没有扩展方法'Element'接受'System.Xml.XmlDocument'类型的第一个参数可能找到(你是否缺少using指令或程序集引用?)
how to read the data in xml file and store those values in hash table.
after loading the excel, to create hash table.
var data = doc.Element("testes").Elements("teste");
getting error for this line at element
Error 1 'System.Xml.XmlDocument' does not contain a definition for 'Element' and no extension method 'Element' accepting a first argument of type 'System.Xml.XmlDocument' could be found (are you missing a using directive or an assembly reference?)
推荐答案
这里有一个关于如何将数据从datatable导出和导入到xml的示例
dt是数据表
here is an example on how to export and import data from datatable to xml vice versa
dt is datatable
dt.TableName = "MyTable";
dt.WriteXml("Path\FileName.xml", XmlWriteMode.WriteSchema);
/*Import xml to datatable */
dt.TableName = "MyTable";
dt.ReadXml("Path\FileName.xml");
how-to-read-a-xml-file-and-return-a-hashtable [ ^ ]
查看links.hope它会有帮助
how-to-read-a-xml-file-and-return-a-hashtable[^]
Check the links.hope it will help
这篇关于如何读取xml文件中的数据并将这些值存储在哈希表中。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!