adrianclay / xbrl

A simple API to parse XBRL taxonomies in PHP.
MIT License
20 stars 10 forks source link

Get Translation Label #1

Closed cicoph closed 8 years ago

cicoph commented 9 years ago

Hi Adrian, thank you for this repo :) I have a question: It is possible to get the translation label of taxonomies? I have different files-idLang.xml with the translation of labels in "en", "fr" and "de" language.

Let me know how if you can and also I think is possible to implement in the Concept.php file the getCustomElement($element) function to get some another custom element not mapped.

Thank you for you time and thanks again :)

adrianclay commented 9 years ago

Hey Francesco,

The Set::getArcsFromConcept method might be useful, it returns all Arcs which you can filter on instanceof Label\Arc and then use the getLabels() method on those objects to get the associated Labels[]. Each Label object has a getLang and getContent method.

cicoph commented 9 years ago

Hi Adrian, thank you for your reply :+1: it works :)

I have another question: it is possible to get the "role" of attributes when import a xbrl file? I need to separate the General Info from bilance info value. To do this I think that I need to get the role of attribute from an xml file (itcc-ci-pre-info-2014-11-17.xml) like for the labels translation. This file contain this rows:

<linkbase xmlns="http://www.xbrl.org/2003/linkbase" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.xbrl.org/2003/linkbase http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd">
  <roleRef xlink:type="simple" xlink:href="itcc-ci-roles-2014-11-17.xsd#InfoGenerali" roleURI="http://www.infocamere.it/itnn/fr/itcc/role/InfoGenerali"/> 
.....

Let me know what do you think about if you can. Thank you :)

adrianclay commented 9 years ago

Hey again,

I've made some modifications in commit f3e38a41166a01d3a5577d0340c7e6d2f3b94bcb to make this possible. You can now get all the ArcCollection objects by calling Set::getArcCollections(). Each ArcCollection has a role associated, which you can retrieve by calling the ArcCollection::getRole() method.

So for example, if I wanted to find all the arcs with a role of "http://www.infocamere.it/itnn/fr/itcc/role/InfoGenerali" I would do the following.

foreach( $set->getArcCollections() as $collection ) {
  if ( $collection->getRole() == "http://www.infocamere.it/itnn/fr/itcc/role/InfoGenerali" ) {
    foreach( $collection as $arc ) {
      echo $arc->getTitle(), "\n";
    }
  }
}