如何从XML文件中提取数据

时间:2022-05-14 15:45:06

I am using the MSXML4.0 parser in VB6. I have an XML file that is browsed and selected by the user. The XML contains lot of tags.I am intersted in mining out the data that is contained in the child nodes of a tag named leadmeasurements. The lead measurements tag will also contain a lot of child nodes... I do not know how to use the MSXML 4.0 . Can anyone help me ?? i need to know wat all functions i need to call to get the nodes named leadmeasurements and then extract data from the child nodes. please give me a sample code that i can refer and get to know how to ues the MSXML4.0 functions effectively..

我在VB6中使用MSXML4.0解析器。我有一个由用户浏览和选择的XML文件。 XML包含很多标签。我在挖掘名为leadmeasurements的标签的子节点中包含的数据时遇到了麻烦。铅测量标签还将包含许多子节点......我不知道如何使用MSXML 4.0。谁能帮我 ??我需要知道我需要调用的所有函数来获取名为leadmeasurements的节点,然后从子节点中提取数据。请给我一个示例代码,我可以参考并了解如何有效地使用MSXML4.0。

2 个解决方案

#1


Ok, so here is how you get the contents of your leadmeasurements node,

好的,所以这里是你如何得到你的铅测量节点的内容,

Dim oDoc AS DOMDocument
Dim oNode AS IXMLDOMNode
Set oDoc = new DOMDocument40
oDoc.Load "MyXmlFile.xml"

Set oNode = oDoc.SelectSingleNode("//leadmeasurements")

MsgBox oNode.Text

Now, what do you want to do with it?

现在,你想用它做什么?

#2


When I was faced with the prospect of parse Xml data in VB6 I created a new COM visible class in DotNet and utilised its Xml processing functions which I could call from VB6.

当我面对在VB6中解析Xml数据的前景时,我在DotNet中创建了一个新的COM可见类,并利用了我可以从VB6调用的Xml处理函数。

#1


Ok, so here is how you get the contents of your leadmeasurements node,

好的,所以这里是你如何得到你的铅测量节点的内容,

Dim oDoc AS DOMDocument
Dim oNode AS IXMLDOMNode
Set oDoc = new DOMDocument40
oDoc.Load "MyXmlFile.xml"

Set oNode = oDoc.SelectSingleNode("//leadmeasurements")

MsgBox oNode.Text

Now, what do you want to do with it?

现在,你想用它做什么?

#2


When I was faced with the prospect of parse Xml data in VB6 I created a new COM visible class in DotNet and utilised its Xml processing functions which I could call from VB6.

当我面对在VB6中解析Xml数据的前景时,我在DotNet中创建了一个新的COM可见类,并利用了我可以从VB6调用的Xml处理函数。