我是一位经验丰富的VBA编码员,但正如您将从
中看到的那样,正在打击XML新手我有以下xml文件Fred.xml
-<Entry>
<ProposalTitle>this is the proposal title</ProposalTitle>
<ProposalOpportunity>this is the proposal opportunity </ProposalOpportunity>
<ProposalBenefits>this is the proposal benefits</ProposalBenefits>
<LocalChangeRepName>local rep name</LocalChangeRepName>
<LocalChangeRepNo>458645</LocalChangeRepPI>
<ProposerName>Proposer name</ProposerName>
<ProposersNo>123454</ProposersPI>
<ProposalDate>18/04/2014</ProposalDate>
</Entry>
并且需要将数据元素从中拉出到一组viariables temp 1到8
中提前致谢
答案 0 :(得分:1)
我可以告诉你我是怎么做到的:
在工具&gt;下添加对MS xml解析器的引用。参考
然后初始化并使用解析器
Dim oDomDoc As MSXML2.DOMDocument30
Set oDomDoc = New MSXML2.DOMDocument30
oDomDoc.async = False
oDomDoc.validateOnParse = False
If Not oDomDoc.Load(sFile) Then
Set oDomDoc = Nothing
'' Handle load failure
End If
String sNodeValue as String
sNodeValue = oDomDoc.selectSingleNode("Entry/ProposalBenefits").Text
你必须做一些关于使用DOM的功课,但这至少应该让你开始。