来自QGIS元数据文件的Google ImportXML [英] Google ImportXML from QGIS metadata file

查看:394
本文介绍了来自QGIS元数据文件的Google ImportXML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Google表格importxml捕获qmd文件(即xml标记)的元素.基于如何使用importXML可以与Google云端硬盘中的文件一起使用?我想我已经正确导入了文件,但似乎无法捕获任何标签.

I am trying to capture elements of an qmd file (that is xml markup) using Google Sheets importxml. Based on How to use importXML function with a file from Google Drive? I think I've got the file importing correctly but can't seem to capture any of the tags.

这就是我正在尝试的-

=importXML("https://drive.google.com/uc?id=1AI2C8hQnSOuuoyJXizYBszGmpMXW8xxT&export=download","\\identifier")

这是qmd/xml文件的样子

Here's what the qmd/xml file looks like

<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis version="3.9.0-Master">
  <identifier>Z:/My Drive/Mangoesmapping/Spatial Projects/2019/DSC/132_Ongoing_Asset_Updates/Working/Sewerage_Updates/Sewerage_Manholes_InspectionShafts.TAB</identifier>
  <parentidentifier>Sewerage Manhole Infrastructure</parentidentifier>
  <language>AUS</language>
  <type>dataset</type>
  <title>Sewerage Manholes within Douglas Shire Council</title>
  <abstract>Sewerage Manholes within Douglas Shire Council. Most data has been updated based on field work, review of existing AsCon files and discussion with council staff responsible for the assets in 2018/2019. In Port Douglas most of the infrastructure has been surveyed in. </abstract>
  <keywords vocabulary="gmd:topicCategory">
    <keyword>Infrastructure</keyword>
    <keyword>Sewerage</keyword>

如果我使用

=importXML("https://drive.google.com/uc?id=1AI2C8hQnSOuuoyJXizYBszGmpMXW8xxT&export=download","*")

我明白了

但是我真的很想通过将每个标签的importxml放在我需要的单元格中来获取想要的元素.

But I really would like to just get the elements I want by placing the importxml for each tag in the cell I need it in.

推荐答案

  • 您要从https://drive.google.com/uc?id=1AI2C8hQnSOuuoyJXizYBszGmpMXW8xxT&export=download
  • 中检索<identifier>###</identifier>###.

    我可以像上面那样理解.如果我的理解是正确的,那么这个答案怎么样?

    I could understand like above. If my understanding is correct, how about this answer?

    在您的问题中,=importXML("https://drive.google.com/uc?id=1AI2C8hQnSOuuoyJXizYBszGmpMXW8xxT&export=download","\\identifier")的公式使用\\identifier作为xpath.您想从数据中检索值,似乎您正在尝试检索<identifier>###</identifier>###.

    In your question, the formula of =importXML("https://drive.google.com/uc?id=1AI2C8hQnSOuuoyJXizYBszGmpMXW8xxT&export=download","\\identifier") uses \\identifier as the xpath. From your data you want to retrieve the values, it seems that you are trying to retrieve ### of <identifier>###</identifier>.

    在这种情况下,为了使用Selects nodes in the document from the current node that match the selection no matter where they are,需要使用//代替\\.可以在此处的文档中看到.

    In this case, in order to Selects nodes in the document from the current node that match the selection no matter where they are, // is required to be used instead of \\. This can be seen at the document of here.

    因此=importXML("https://drive.google.com/uc?id=1AI2C8hQnSOuuoyJXizYBszGmpMXW8xxT&export=download","\\identifier")可以进行如下修改.

    So =importXML("https://drive.google.com/uc?id=1AI2C8hQnSOuuoyJXizYBszGmpMXW8xxT&export=download","\\identifier") can be modified as follows.

    =importXML("https://drive.google.com/uc?id=1AI2C8hQnSOuuoyJXizYBszGmpMXW8xxT&export=download","//identifier")
    

    与其他xpath一样,从问题数据中,您也可以使用/qgis/identifier的xpath代替//identifier.因此,您也可以使用以下公式.

    As other xpath, from your data in your question, you can also use the xpath of /qgis/identifier instead of //identifier. So you can also use the following formula.

    =importXML("https://drive.google.com/uc?id=1AI2C8hQnSOuuoyJXizYBszGmpMXW8xxT&export=download","/qgis/identifier")
    

    参考文献:

    • IMPORTXML
    • XPath教程
    • References:

      • IMPORTXML
      • XPath Tutorial
      • 这篇关于来自QGIS元数据文件的Google ImportXML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆