【发布时间】:2015-02-11 16:24:16
【问题描述】:
我正在尝试将此 XML 提要导入 Google 电子表格: http://cloud.tfl.gov.uk/TrackerNet/LineStatus
但我似乎无法为要解析的提要获得正确的 xPath。
我试过了:
=importxml("http://cloud.tfl.gov.uk/TrackerNet/LineStatus","/ArrayOfLineStatus")
和
=importxml("http://cloud.tfl.gov.uk/TrackerNet/LineStatus","/arrayoflinestatus//linestatus[1]@statusdetails")
其他一些,但没有运气。我一直在使用http://xmltoolbox.appspot.com/xpath_generator.html 来尝试获取 Xpath。
编辑:
这是 XML 的编辑版本:
<ArrayOfLineStatus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://webservices.lul.co.uk/">
<LineStatus ID="0" StatusDetails="">
<BranchDisruptions/>
<Line ID="1" Name="Bakerloo"/>
<Status ID="GS" CssClass="GoodService" Description="Good Service" IsActive="true">
<StatusType ID="1" Description="Line"/>
</Status>
<LineStatus ID="81" StatusDetails="">
<BranchDisruptions/>
<Line ID="81" Name="DLR"/>
<Status ID="GS" CssClass="GoodService" Description="Good Service" IsActive="true">
<StatusType ID="1" Description="Line"/>
</Status>
</LineStatus>
</ArrayOfLineStatus>
【问题讨论】:
-
抱歉,我输入了错误的 URL。我现在已经修复了它以及它返回的一些 XML。
标签: xml xpath google-sheets google-sheets-importxml