我的问题是,我有两个xml(xbrl)文件,这是XBRLfiles和file1是测试文件和file2是由一些tool.Both生成的数据是相同的,但很少有像上下文( ID),单元(ID)和概念(名称和ID)的变化。以下是这些文件
*File1(测试文件,也可以说是基础文件进行比较)*
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href = "D:/Devang Barot/XSLT/Compare/sorting.xsl"?>
<!-- Copyright 2007 XBRL International. All Rights Reserved. -->
<xbrl
xmlns="http://www.xbrl.org/2003/instance"
xmlns:concept="http://xbrl.org/formula/conformance/example"
xmlns:link="http://www.xbrl.org/2003/linkbase"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:iso4217="http://www.xbrl.org/2003/iso4217">
<link:schemaRef
xlink:type="simple"
xlink:href="12030-concept-tests.xsd"/>
<link:linkbaseRef
xlink:type="simple"
xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase"
xlink:href="12030-dynamic-concept-formula.xml"/>
<context id="c1">
<entity>
<identifier scheme="http://xbrl.org/entity/identification/scheme">AAA001</identifier>
</entity>
<period>
<instant>2007-01-01</instant>
</period>
</context>
<context id="c2">
<entity>
<identifier scheme="http://xbrl.org/entity/identification/scheme">BBB002</identifier>
</entity>
<period>
<instant>2007-02-02</instant>
</period>
</context>
<context id="c3">
<entity>
<identifier scheme="http://xbrl.org/entity/identification/scheme">CCC003</identifier>
</entity>
<period>
<instant>2007-03-03</instant>
</period>
</context>
<context id="c4">
<entity>
<identifier scheme="http://xbrl.org/entity/identification/scheme">DDD004</identifier>
</entity>
<period>
<instant>2007-04-04</instant>
</period>
</context>
<unit id="u1">
<measure>iso4217:JPY</measure>
</unit>
<unit id="u2">
<measure>iso4217:KPW</measure>
</unit>
<unit id="u3">
<measure>iso4217:THB</measure>
</unit>
<unit id="u4">
<measure>iso4217:TOP</measure>
</unit>
<!-- note that the concepts are reversed by the qname expression -->
<concept:m4 contextRef="c1" unitRef="u1" precision="0">11000</concept:m4>
<concept:m3 contextRef="c2" unitRef="u2" precision="0">2200</concept:m3>
<concept:m2 contextRef="c3" unitRef="u3" precision="0">330</concept:m2>
<concept:m1 contextRef="c4" unitRef="u4" precision="0">44</concept:m1>
</xbrl>*文件2(由某个工具生成)*
<xbrl xmlns="http://www.xbrl.org/2003/instance" xmlns:eg="http://xbrl.org/formula/conformance/example" xmlns:concept="http://xbrl.org/formula/conformance/example" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:iso4217="http://www.xbrl.org/2003/iso4217">
<link:schemaRef xlink:type="simple" xlink:href="12030-concept-tests.xsd"/>
<link:linkbaseRef xlink:type="simple" xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase" xlink:href="12030-dynamic-concept-formula.xml" />
<context id="context_0">
<entity>
<identifier scheme="http://xbrl.org/entity/identification/scheme">AAA001</identifier>
</entity>
<period>
<instant>2007-01-01</instant>
</period>
</context>
<unit id="unit_0">
<measure>iso4217:JPY</measure>
</unit>
<eg:m4 contextRef="context_0" unitRef="unit_0" precision="0">11000.0</eg:m4>
<context id="context_1">
<entity>
<identifier scheme="http://xbrl.org/entity/identification/scheme">BBB002</identifier>
</entity>
<period>
<instant>2007-02-02</instant>
</period>
</context>
<unit id="unit_1">
<measure>iso4217:KPW</measure>
</unit>
<eg:m3 contextRef="context_1" unitRef="unit_1" precision="0">2200.0</eg:m3>
<context id="context_2">
<entity>
<identifier scheme="http://xbrl.org/entity/identification/scheme">CCC003</identifier>
</entity>
<period>
<instant>2007-03-03</instant>
</period>
</context>
<unit id="unit_2">
<measure>iso4217:THB</measure>
</unit>
<eg:m2 contextRef="context_2" unitRef="unit_2" precision="0">330.0</eg:m2>
<context id="context_3">
<entity>
<identifier scheme="http://xbrl.org/entity/identification/scheme">DDD004</identifier>
</entity>
<period>
<instant>2007-04-04</instant>
</period>
</context>
<unit id="unit_3">
<measure>iso4217:TOP</measure>
</unit>
<eg:m1 contextRef="context_3" unitRef="unit_3" precision="0">44.0</eg:m1>
</xbrl>如果任何人能够比较这一点,并且我们只希望得到TRUE和FALSE的结果。
我已经应用了functx的逻辑:index- of -node functx:deep-Sequence functx:Sequence deep-Sequence functx:destinct deep
但是找不到它..任何帮助都是非常感谢的。谢谢
发布于 2017-06-23 14:32:04
通过两个XBRL实例的低级XML语法比较这两个实例要比比较两个XBRL实例要复杂得多。XBRL有自己的数据模型,必须对该数据模型进行比较(理想情况下使用XBRL处理器,请参阅最终注释)。
在XML语法级别上,比较事实的确切标准(相同的上下文、相同的单位、相同的值等)被指定为here in the specification。
不应该需要深度相等,除非在(非常)特定的(不建议的)使用复杂类型的类型维度的情况下,但这里不是这种情况。人们需要测试这些事实是相互映射的,并测试候选事实对:
iso4217前缀通常用于货币,但谁也不知道)。date/dateTime比较的语义)。这里不涉及维度,这使得比较更简单。以及,对于通过上述比较的一对事实:
概念类型的值(理想情况下也使用taxonomy)
中的
XPath/XQuery/XSLT (如果需要,可以使用functx )可能是一种很好的方法,但它将是一个复杂的查询。通常,这对于正常导航、过滤谓词以匹配In、值比较、量词、转换(to date、dateTime)、QName比较等可能是可行的。
请注意:
XBRL负责将实例的
在本例中,它很简单,因为文档相当简单,并且不涉及高级特性,但通常情况下,如果您尝试这样做,实际上将最终从头开始重新编写XBRL处理器。
发布于 2017-07-17 17:24:22
您需要进行语义xbrl比较。
在语义xbrl比较中,属于底层规范的属性(例如in、idrefs、xlink:label、xlink:to、xlink:from甚至xlink:href)不会使用其文本表示进行比较,而是使用XBRL 2.1规范的4.10节中已经定义的比较机制来比较被引用的对象
我们已经实现了一个XBRL语义比较器,可以在我们的网站上使用。您可以从以下链接下载Java源代码:
http://www.reportingstandard.org/samples.zip
在该文件上有一个java类com.ihr.xbrl.sample.LaunchIXBRLv11ConformanceSuiteXHTML,在这个类上有一个公共的静态Diff makeXBRLDiff(URL,URL)方法,该方法通过在目标文件上搜索语义等价的节点来生成差异报告。
https://stackoverflow.com/questions/44713710
复制相似问题