【问题标题】:Import Internal Error during ImportXML with Google Spreadsheet even without /tbody即使没有 /tbody,在使用 Google 电子表格的 ImportXML 期间导入内部错误
【发布时间】:2014-11-20 16:21:10
【问题描述】:

我正在尝试从 http://www.klse.my/stock/entitlement/dividend/7087.jsp#stockDetailDiv 并链接自 http://www.bursamalaysia.com/market/listed-companies/company-announcements/#/?category=EA&company=7087 网站到我的谷歌电子表格,但谷歌工作表给我导入内部错误。

=IMPORTXML("http://www.klse.my/stock/entitlement/dividend/7087.jsp#stockDetailDiv","//*[@id='entitlementTable']/tr[2]/td")    

=IMPORTXML("http://www.bursamalaysia.com/market/listed-companies/company-announcements/#/?category=EA&company=7087","//*[@id='bm_ajax_container']/div/table/tr/td[4]/a/@href")    

我真的不知道是什么导致了这个问题,但我曾经通过使用 xpath 查询并删除 /tbody 来克服它。这次我找不到有效的 xpath 查询。

有没有编程专家知道这个错误的原因,或者我怎样才能让它工作?感谢并感谢您的帮助

【问题讨论】:

    标签: xml xpath xml-parsing google-sheets google-docs


    【解决方案1】:

    尝试使用

    =IMPORTXML("https://en.wikipedia.org/wiki/Moon_landing"; "//a/@href") (semicolon)
    instead
    =IMPORTXML("https://en.wikipedia.org/wiki/Moon_landing", "//a/@href")
    

    官方文档:https://support.google.com/docs/answer/3093342?hl=en

    【讨论】:

    • 嗨.. 感谢您的帮助,但我仍然遇到同样的错误:(
    【解决方案2】:

    这应该可行 - 它会拉入表格:

    =IMPORTHTML("http://www.klse.my/stock/entitlement/dividend/7087.jsp#stockDetailDiv","table",1)
    

    或者这个:

    =IMPORTXML("http://www.klse.my/stock/entitlement/dividend/7087.jsp#stockDetailDiv","//tr")
    

    一些导致拉入困难的原因,通常是由于页面加载后加载 jquery - 它是动态的,而不是静态的或在 html 本身中是永久的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-04
      相关资源
      最近更新 更多