【问题标题】:Problem with selectSingleNode on ms-access vbams-access vba 上的 selectSingleNode 问题
【发布时间】:2020-07-13 14:21:07
【问题描述】:

我在访问 vba 时使用这个简单的子

Public Sub ReadXml()
    ' XML FILE:
    ' <A>
    '     <B>sometext</B>
    ' </A>
    Dim n As New MSXML2.DOMDocument60
    Dim n1 As MSXML2.IXMLDOMNode
    Const NomeFile = "C:\file.xml"
    n.async = False
    n.validateOnParse = False
    If n.Load(NomeFile) Then
        Set n1 = n.selectSingleNode("A/B")
        Debug.Print n1.Text ' <===  error
    End If
End Sub

运行时收到 91 运行时错误

【问题讨论】:

    标签: xml vba ms-access domdocument msxml2


    【解决方案1】:

    selectSingleNode() 中的 XPath 应该是“A/B”(正斜杠,而不是您使用的反斜杠)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-07-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多