如何读取xml文件 [英] How to read xml file
问题描述
大家好,
我正在尝试使用数据集读取xmlfile,我在这里遵循的步骤是
1.访问数据库并获取数据表
2.将数据表转换为xmldoucment
3.在这里,我喜欢使用数据集阅读转换后的xmldocument
为此,我在
中尝试了
Hi all,
i am trying to read the xmlfile using data set the steps i followed here are
1. accessing the database and getting the datatable
2. converting datatable into xmldoucment
3. here i like read the converted xmldocument using dataset
for this i tried in
dim ds as dataset
ds.readXml(xmldocument)
但我在这里遇到错误...
错误1重载解析失败,因为无法使用以下参数调用可访问的"ReadXml":
``公共功能ReadXml(文件名作为字符串)作为System.Data.XmlReadMode'':类型``System.Xml.XmlDocument''的值不能转换为``String''.
``公共功能ReadXml(阅读器作为System.IO.TextReader)作为System.Data.XmlReadMode'':不能将类型为``System.Xml.XmlDocument''的值转换为``System.IO.TextReader''. br/>
``公共功能ReadXml(流作为System.IO.Stream)作为System.Data.XmlReadMode'':类型``System.Xml.XmlDocument''的值不能转换为``System.IO.Stream''.
``公共功能ReadXml(阅读器作为System.Xml.XmlReader)作为System.Data.XmlReadMode'':不能将类型为``System.Xml.XmlDocument''的值转换为``System.Xml.XmlReader''. D:\ Seshu \ Ajaxsite \ Handler.ashx 43 9 D:\ Seshu \ Ajaxsite \
任何人都可以告诉我如何获得上述第三步.
在此先感谢
Seshu
but i am getting errors here...
Error 1 Overload resolution failed because no accessible ''ReadXml'' can be called with these arguments:
''Public Function ReadXml(fileName As String) As System.Data.XmlReadMode'': Value of type ''System.Xml.XmlDocument'' cannot be converted to ''String''.
''Public Function ReadXml(reader As System.IO.TextReader) As System.Data.XmlReadMode'': Value of type ''System.Xml.XmlDocument'' cannot be converted to ''System.IO.TextReader''.
''Public Function ReadXml(stream As System.IO.Stream) As System.Data.XmlReadMode'': Value of type ''System.Xml.XmlDocument'' cannot be converted to ''System.IO.Stream''.
''Public Function ReadXml(reader As System.Xml.XmlReader) As System.Data.XmlReadMode'': Value of type ''System.Xml.XmlDocument'' cannot be converted to ''System.Xml.XmlReader''. D:\Seshu\Ajaxsite\Handler.ashx 43 9 D:\Seshu\Ajaxsite\
anyone can tell me how to get the third step in the above.
Thanks in advance
Seshu
推荐答案
您提供的参数xmldocument
不是以下受支持的类型之一:
The parameterxmldocument
you provide is not one of the following supported types:
fileName As String
reader As System.IO.TextReader
stream As System.IO.Stream
reader As System.Xml.XmlReader
在这里看看:
http://msdn.microsoft.com/en-us/library/d6swf149.aspx#Y1026 [^ ]
祝你好运!
Have a look here:
http://msdn.microsoft.com/en-us/library/d6swf149.aspx#Y1026[^]
Good luck!
这是将XML文件读入数据集的最简单方法.
That is the easiest way to read an XML file into a dataset.
dim ds as dataset
ds.readXML("c:\yourxmlfile.xml")
在此处查看可用于Dataset.ReadXML
的更多设置
MSDN:Dataset.readXML [
Have a look here for more settings that you can use with Dataset.ReadXML
MSDN: Dataset.readXML[^]
这篇关于如何读取xml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!