【问题标题】:Extracting Data from XBRL with XPath使用 XPath 从 XBRL 中提取数据
【发布时间】:2014-02-16 13:57:59
【问题描述】:

我正在尝试使用 Talend Studio 中的 XPath 表达式从 XBRL 文件中提取一些数据点。我想提取所有 ShareHolderFunds 值及其相关期间的结束日期(由“ContextRef”属性引用),以及公司注册号。我正在努力建立指向期间结束日期的链接 - 目前我的代码错误地为两个 ShareHolderFund 值返回相同的结束日期。

这是我的代码 Talend Studio 的屏幕截图:

这里是 XBRL 的摘录:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="http://www.companieshouse.gov.uk/ef/xbrl/uk/fr/gaap/ae/2009-06-21/stylesheet/CH-AE-stylesheet.xsl"?>
<xbrl xmlns="http://www.xbrl.org/2003/instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ae="http://www.companieshouse.gov.uk/ef/xbrl/uk/fr/gaap/ae/2009-06-21" xmlns:gc="http://www.xbrl.org/uk/fr/gcd/2004-12-01" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:iso4217="http://www.xbrl.org/2003/iso4217" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:pt="http://www.xbrl.org/uk/fr/gaap/pt/2004-12-01" xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<link:schemaRef xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase" xlink:href="http://www.companieshouse.gov.uk/ef/xbrl/uk/fr/gaap/ae/2009-06-21/uk-gaap-ae-2009-06-21.xsd" xlink:type="simple" />
<ae:CompanyNotDormant contextRef="y2013">true</ae:CompanyNotDormant>
<gc:EntityNames>
  <gc:EntityCurrentLegalName contextRef="y2013">A &amp; Co. Limited</gc:EntityCurrentLegalName>
</gc:EntityNames>
<ae:CompanyIdentifyingNumbers>
  <ae:CompaniesHouseRegisteredNumber contextRef="y2013">123456</ae:CompaniesHouseRegisteredNumber>
</ae:CompanyIdentifyingNumbers>
<gc:StatementDatesPeriodsCovered>
  <gc:BalanceSheetDate contextRef="e2013">2013-03-31</gc:BalanceSheetDate>
</gc:StatementDatesPeriodsCovered>

<pt:ShareholderFunds precision="5" contextRef="e2013" unitRef="GBP">5286</pt:ShareholderFunds>
<pt:ShareholderFunds precision="5" contextRef="e2012" unitRef="GBP">5446</pt:ShareholderFunds>

<unit id="shares">
  <measure>xbrli:shares</measure>
</unit>
<unit id="GBP">
  <measure>iso4217:GBP</measure>
</unit>
<unit id="pure">
  <measure>xbrli:pure</measure>
</unit>

<context id="e2012">
  <entity>
    <identifier scheme="Ellco/results">A &amp; Co. Limited</identifier>
  </entity>
  <period>
    <instant>2012-03-31</instant>
  </period>
</context>
<context id="s2013">
  <entity>
    <identifier scheme="Ellco/results">A &amp; Co. Limited</identifier>
  </entity>
  <period>
    <instant>2012-03-31</instant>
  </period>
</context>
<context id="e2013">
  <entity>
    <identifier scheme="Ellco/results">A &amp; Co. Limited</identifier>
  </entity>
  <period>
    <instant>2013-03-31</instant>
  </period>
</context>
<ae:CompaniesHouseDocumentAuthentication contextRef="y2013"> </ae:CompaniesHouseDocumentAuthentication>
<ae:DateAccountsReceived contextRef="e2013">2013-12-25</ae:DateAccountsReceived>
</xbrl>

【问题讨论】:

    标签: xml xpath talend xbrl


    【解决方案1】:

    使用 XPath,我可以通过以下代码选择两个不同的日期:

    /xbrl/context[@id = /xbrl/pt:ShareholderFunds/@contextRef]/period/instant
    

    表达式选择与/xbrl/pt:ShareholderFunds contextRef 属性对应的id 属性的xbrl/context 元素,并在每个元素中获取period/instant。选择的结果是一个节点集,包含:

    2012-03-31
    2013-03-31
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-15
      • 2013-04-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多