使用Google表格导入xml从XML提取子类别信息 [英] Extract sub category info from XML using Google Sheets import xml

查看:134
本文介绍了使用Google表格导入xml从XML提取子类别信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Google表格importxml捕获qmd文件(即xml标记)的元素.根据对我的问题的答复 QGIS元数据中的Google ImportXML文件,我可以捕获主要标签.

I am trying to capture elements of an qmd file (that is xml markup) using Google Sheets importxml. Based on the reply to my question Google ImportXML from QGIS metadata file I am able to capture the primary tag.

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

但是我无法访问某些元素

However I can't access some elements

    <spatialrefsys>
      <proj4>+proj=utm +zone=55 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs</proj4>
      <srsid>2449</srsid>
      <srid>28355</srid>
      <authid>EPSG:28355</authid>
      <description>GDA94 / MGA zone 55</description>
      <projectionacronym>utm</projectionacronym>
      <ellipsoidacronym>GRS80</ellipsoidacronym>
      <geographicflag>false</geographicflag>
    </spatialrefsys>
  </crs>
  <extent>
    <spatial minx="322783.17999999999301508" minz="0" crs="EPSG:28355" maxx="337384.35999999998603016" miny="8170597.66000000014901161" maxz="0" dimensions="2" maxy="8181833.33999999985098839"/>
    <temporal>
      <period>
        <start></start>
        <end></end>
      </period>
    </temporal>
  </extent>

在//我想要的范围内,minx,maxx

From the //extent I want minx, maxx

对于XPath,我尝试了"//extent", "//extent/spatial", "//extent/spatial[@*]" and "@minx"

for XPath I have tried "//extent", "//extent/spatial", "//extent/spatial[@*]" and "@minx"

但没有结果.

推荐答案

  • 您要使用IMPORTXML()检索maxxminx的值.
    • You want to retrieve the values of maxx and minx using IMPORTXML().
    • 如果我的理解是正确的,那么该修改如何?

      If my understanding is correct, how about this modification?

      =TRANSPOSE(IMPORTXML(A1,"//spatial/@maxx | //spatial/@minx"))
      

      • https://drive.google.com/uc?id=1AI2C8hQnSOuuoyJXizYBszGmpMXW8xxT&export=download放在单元格"A1"中.
      • 在这种情况下,//spatial/@maxx | //spatial/@minx用作xpath.
        • 可以使用@检索配饰值.
          • https://drive.google.com/uc?id=1AI2C8hQnSOuuoyJXizYBszGmpMXW8xxT&export=download is put in the cell "A1".
          • In this case, //spatial/@maxx | //spatial/@minx is used as the xpath.
            • Attibute values can be retrieved with @.
            • 例如,如果要使用这些值作为文本,那么下面的公式如何?

              If you want to use the values as the text, for example, how about the following formula?

              =TRANSPOSE(ARRAYFORMULA(TEXT(IMPORTXML(A1,"//spatial/@maxx | //spatial/@minx"),"0.0000000000")))
              

              如果我误解了您的问题,而这不是您想要的结果,我深表歉意.

              If I misunderstood your question and this was not the result you want, I apologize.

              这篇关于使用Google表格导入xml从XML提取子类别信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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