XBRL Processor Development Guide - 富士通の...

78
B1WD-3105-01ENZ0(00) Interstage XWand V12 XBRL Processor Development Guide Java Interface(XBRL 2.1)

Transcript of XBRL Processor Development Guide - 富士通の...

Page 1: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

B1WD-3105-01ENZ0(00)

Interstage XWand V12

XBRL Processor Development Guide

Java Interface(XBRL 2.1)

Page 2: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

ii

Preface

Purpose

This manual, the Interstage XWand Development Guide, is intended for developers of

applications that can handle XML documents compliant with the syntax defined in the XBRL 2.1 using the XBRL processor provided by Interstage XWand. The manual provides an outline of

the XBRL processor, and describes XBRL processor-supported functions and how to use them.

Intended Readers

This manual is intended for developers who use the XBRL processor provided by Interstage XWand to develop user applications that can handle XML documents compliant with the syntax

defined in the XBRL 2.1 Specification.

Prerequisite Knowledge

Readers are assumed to have an understanding of the following standard specifications and

related standard specifications:

- Extensible Markup Language (XML) 1.0 (Second Edition) W3C Recommendation 6 October 2000

- XML Schema Part 0: Primer W3C Recommendation, 28 October 2004

- XML Schema Part 1: Structures W3C Recommendation 28 October 2004 - XML Schema Part 2: Datatypes W3C Recommendation 28 October 2004

- Namespaces in XML World Wide Web Consortium 14-January-1999 - XML Path Language (XPath) Version 1.0 W3C Recommendation 16 November 1999

- XPointer Framework W3C Recommendation 25 March 2003 - XPointer element() Scheme W3C Recommendation 25 March 2003

- XML Base W3C Recommendation 27 June 2001 - XML Linking Language (XLink) Version1.0 W3C Recommendation 27 June 2001

- XBRL 2.1 Specification - Document Object Model (DOM) Level 2 Core Specification Version 1.0

Organization of This Manual

This manual has the seven chapters and two appendixes listed below.

Chapter 1 XBRL Processor Overview Chapter 1 provides an overview of the XBRL processor.

Chapter 2 Basic XBRL Processor Information Chapter 2 provides basic information for use of the XBRL processor.

Chapter 3 Creating and Saving XBRL Data Models Chapter 3 explains how to create and save documents using XBRL data models.

Chapter 4 Referencing with XBRL Data Models Chapter 4 explains how to reference document information by using XBRL data models.

Chapter 5 Modifying with XBRL Data Models Chapter 5 explains how to register and modify document information by using XBRL data

models. Chapter 6 Tutorial

Chapter 6 explains in detail how to use XBRL data models.

Page 3: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

iii

Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications and restrictions to keep in mind when using this product.

Chapter 8 Changes in API Specifications Chapter 8 explains the changes in API specifications from the previous version.

Appendix A Tutorial Source Code Appendix A provides a complete version of the source code explained in Chapter 6,

"Tutorial," and its execution results. Appendix B Samples of Overridden Documents

Appendix B provides samples of documents with overridden links.

How to Use this Manual

This manual is a development guide for the following product:

- XBRL processor This manual has been prepared to assist persons using the manual and the related manual (see

below) in developing XBRL document-processing applications using the XBRL processor.

Related Manual

XBRL 2.1 Java Interface API Reference (hereinafter called as "XBRL API Reference")

Export Restrictions

This software product is designed primarily for use in the country to which the software is

imported. The software must not be re-exported from the country without authorization from the appropriate government authorities in accordance with the Foreign Exchange and Foreign Trade

Control Law of the country. In no event will Fujitsu be liable for foreign government or third-party claims for compensation or damages whatsoever arising from the use of the software

resulting in any violation of the laws and ordinances of the country or those of the relevant country. Fujitsu assumes no responsibility for any problems or damages arising from such use of

the software outside the country. If Fujitsu suffers any damages as a result of a user's violation of the above laws, Fujitsu reserves the right to claim compensation from the user.

Abbreviation

In this manual, the Interstage XWand XBRL Processor is referred to as:

- XBRL Processor

Page 4: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

iv

Trademarks

XBRL, is a trademark or service mark of XBRL International, Inc., registered in the United

States and in other countries. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of

their respective owners. Other company names and product names are trademarks or registered trademarks of their

respective owners. Company and product names appearing in this manual are the trademarks or registered

trademarks of their respective owners. The contents of this manual may be revised without prior notice.

The contents of this manual shall not be reproduced in any way or form without the express written permission of Fujitsu Limited.

Fujitsu assumes no responsibility for infringement of any patent rights or other rights of third parties arising from the use of the information in this manual.

Date of Issue

December 2011: First Edition

Page 5: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

v

Contents

CONTENTS V

CHAPTER 1 XBRL PROCESSOR OVERVIEW .............................................................................................. 1

1.1 PURPOSE ............................................................................................................................................................................... 1 1.2 TERMINOLOGY .................................................................................................................................................................... 1

CHAPTER 2 BASIC XBRL PROCESSOR INFORMATION ......................................................................... 2

2.1 XBRL DOCUMENTS ........................................................................................................................................................... 2 2.1.1 Overview of Instance document elements ......................................................................................................... 2 2.1.2 Overview of taxonomy structure.......................................................................................................................... 3

2.2 XBRL DATA MODEL ........................................................................................................................................................ 3 2.2.1 Models common to instance documents and taxonomies ............................................................................. 4 2.2.2 Model specific to an instance document ........................................................................................................... 7 2.2.3 Model specific to taxonomies ............................................................................................................................... 8

2.3 OVERVIEW OF THE XBRL PROCESSOR ......................................................................................................................... 9 2.4 XBRL PROCESSOR SETTINGS ............................................................................................................................................ 10

2.4.1 Setting an error handler ........................................................................................................................................... 10 2.4.2 Setting an entity resolver .......................................................................................................................................... 10 2.4.3 Setting a taxonomy set resolver ............................................................................................................................... 11

CHAPTER 3 CREATING AND SAVING XBRL DATA MODELS ............................................................. 13

3.1 CREATING AN XBRL DATA MODEL ........................................................................................................................... 13 3.1.1 Creating an XBRL data model ........................................................................................................................... 13 3.1.2 Converting an existing XBRL document into an XBRL data model ....................................................... 13 3.1.3 Creating an XBRL data model from serialized data ................................................................................... 13 3.1.4 Creating an XBRL data model by reading extended taxonomy additionally ....................................... 13

3.2 SAVING AN XBRL DATA MODEL ................................................................................................................................ 15 3.2.1 Saving as an XBRL document ............................................................................................................................ 15 3.2.2 Serialization ............................................................................................................................................................ 15

CHAPTER 4 REFERENCING WITH XBRL DATA MODELS .................................................................... 16

4.1 SCHEMA .............................................................................................................................................................................. 16 4.1.1 Referencing a schema ........................................................................................................................................... 17 4.1.2 Referring to "element" elements ........................................................................................................................ 19

4.2 INSTANCE DOCUMENT .................................................................................................................................................... 21 4.2.1 Referencing instance information ..................................................................................................................... 21 4.2.2 Referencing context and unit .............................................................................................................................. 21 4.2.3 Referencing item values ....................................................................................................................................... 22

4.3 LINKS ................................................................................................................................................................................... 24 4.3.1 Linkbase information ............................................................................................................................................ 25 4.3.2 Link and link information .................................................................................................................................... 25 4.3.3 Referencing a relation link .................................................................................................................................. 25 4.3.4 Referencing a resource link ................................................................................................................................ 29 4.3.5 Executing calculations and referencing calculation results via calculation links ................................... 30 4.3.6 Referencing links where overriding is resolved ...................................................................................................... 31

Page 6: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

vi

CHAPTER 5 MODIFYING WITH XBRL DATA MODELS ........................................................................... 32

5.1 ADDING A NEW ELEMENT .............................................................................................................................................. 32 5.2 CHANGING THE CONTENTS OF AN EXISTING ELEMENT ......................................................................................... 33 5.3 DELETING AN EXISTING ELEMENT .............................................................................................................................. 33 5.4 OVERRIDING LINKS .......................................................................................................................................................... 34

5.4.1 Link overriding ....................................................................................................................................................... 34 5.4.2 Creating a process for overriding .................................................................................................................... 34

CHAPTER 6 TUTORIAL ....................................................................................................................................... 36

6.1 CREATING A NEW TAXONOMYSET .............................................................................................................................. 36 6.2 ADDING A SCHEMA .......................................................................................................................................................... 36 6.3 IMPORTING XBRL-INSTANCE.XSD ................................................................................................................................. 36 6.4 ADDING AN "ELEMENT" ELEMENT .............................................................................................................................. 37 6.5 ADDING A LINK ................................................................................................................................................................. 37

6.5.1 Adding a relation link ........................................................................................................................................... 37 6.5.2 Adding a resource link ......................................................................................................................................... 38

6.6 CREATING AN INSTANCE AND ADDING AN ITEM ..................................................................................................... 38 6.7 SAVING XBRL DOCUMENTS ......................................................................................................................................... 40

CHAPTER 7 SPECIFICATIONS AND RESTRICTIONS.............................................................................. 41

7.1 HANDLING OF ELEMENTS BY THE XBRL PROCESSOR ........................................................................................... 41 7.1.1 Elements relating to taxonomies and schemas .............................................................................................. 41 7.1.2 Elements relating to linkbases ........................................................................................................................... 45 7.1.3 Instance-related elements .................................................................................................................................... 47 7.1.4 Common elements .................................................................................................................................................. 50

7.2 OTHER SPECIFICATIONS .................................................................................................................................................. 51 7.3 RESTRICTIONS ................................................................................................................................................................... 52 7.4 NOTES .................................................................................................................................................................................. 52

CHAPTER 8 CHANGES IN API SPECIFICATIONS .......................................................................................... 53

8.1 CHANGES / DIFFERENCES IN API SPECIFICATIONS FROM V1.2 ........................................................................................ 53 8.2 CHANGES / DIFFERENCES IN API SPECIFICATIONS FROM V7.0 ........................................................................................ 58 8.3 CHANGES / DIFFERENCES IN API SPECIFICATIONS FROM V7.1 ........................................................................................ 61 8.4 CHANGES / DIFFERENCES IN API SPECIFICATIONS FROM V9.0 ........................................................................................ 62

APPENDIX A TUTORIAL SOURCE CODE ...................................................................................................... 64

APPENDIX B SAMPLES OF OVERRIDDEN DOCUMENTS ....................................................................... 70

Page 7: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 1 XBRL Processor Overview

1

Chapter 1 XBRL Processor Overview

1.1 Purpose

The XBRL processor provides a function for handling instance documents and taxonomies as defined in the XBRL 2.1 Specification.

1.2 Terminology

This manual uses the terms defined in the following specification: XBRL2.1 Specification

Other terms are explained below.

XBRL document A general term for instance documents and taxonomies

XBRL data model A unique data model provided by the XBRL processor. An XBRL data model is configured so

that instance documents and taxonomies can be handled. Item definition element

An abbreviation for the "element" element of the schema defining an item Tuple definition element

An abbreviation for the "element" element of the schema defining a tuple XBRL element

A generic term for item definition elements and tuple definition elements, or structure elements of the XBRL data model corresponding to them

Taxonomy set Structure element of the XBRL data model that is used to model the Discoverable Taxonomy Set

(DTS). Property

Attributes related to XBRL processor operation Link information

General term for information on links such as arcs and locators Override

A function that overrides links to replace them. For details, see Section 5.4 "Overriding Links"

Page 8: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 2 Basic XBRL Processor Information

2

Chapter 2 Basic XBRL Processor Information

The XBRL processor creates a model of the syntax defined in the XBRL 2.1 Specification so that XBRL

documents can be used in a Java execution environment. This chapter covers the following:

1) Overview of XBRL documents 2) Relationship between XBRL documents and XBRL data models

3) XBRL document processing by the XBRL processor

2.1 XBRL Documents

XBRL documents are classified into instance documents and taxonomies.

2.1.1 Overview of Instance document elements

Taxonomies describe the relationships between elements making up an instance document. An instance document, with its elements and attributes, stores different types of facts as business entities.

The figure below shows the structure of an instance document. Some elements and attributes are omitted.

Context elements

Tuple elements

Item elements

Tuple elements

footnoteLink element

Item elements

roleRef/arcroleRef element

schemaRef/linkbaseRef element

Unit elements

xbrl element

Figure 1 Structure of instance document

Page 9: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 2 Basic XBRL Processor Information

3

2.1.2 Overview of taxonomy structure

A taxonomy consists of a schema and linkbase. The schema defines the method of coding an instance document with an "element" element. The linkbase defines the relationships between XBRL elements or

between XBRL elements and their associated information. The figure below shows the structure of the schema. Some elements and attributes are omitted.

schema element

"element" elements

appinfo elements

import elements

annotation elements

linkbaseRef element

Figure 2 Structure of the schema

The figure below shows the structure of the linkbase. Note that some elements and attributes are omitted.

linkbase element

Extended link declaration elements

Locator resource elements

Arc elements

Figure 3 Structure of the linkbase

2.2 XBRL Data Model

The XBRL data model is a model for instance documents and taxonomies and natively supported by the

XBRL processor. Compared with DOMs, XBRL data models simplify operations on instance documents and taxonomies based on the XBRL 2.1 specification.

XBRL data models are classified into the following three types: Models common to instance documents and taxonomies

Models specific to an instance document Models specific to taxonomies

Page 10: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 2 Basic XBRL Processor Information

4

2.2.1 Models common to instance documents and taxonomies

The common data model is a model for the following elements and structures: Common characteristics of XBRL documents

Instance documents, schemas, and linkbase documents are included in the model.

<<interface>>

XBRLDocument

<<interface>> Instance

<<interface>> XMLSchema

Common characteristics for each XBRL documents are modeled.

<<interface>> Linkbase Documents that

provides linkbases

Document that provides instances

Document that provides schemas

Figure 4 Common data model

Page 11: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 2 Basic XBRL Processor Information

5

Basic information about links

- Information representing individual links that are associated with extended-link-type elements and their sub-elements is modeled.

<<interface>>

LinkInformation

<<interface>> Arc

<<interface>> Locator

Provides information about an arc-type element.

Provides information about an locator-type element or resource-type element.

Provides one piece of information about the beginning and end of a link included in one XLink declaration.

1 2

1 1

<<interface>>

XBRLDocument

<<interface>>XLinkDecl

Provides information about an extended-link-type element of one XLink declaration.

<<interface>>Arc

<<interface>>Locator

1 *

1 *

1 *

Figure 5 Basic information about links

- Characteristics common to extended-link-type elements and their sub-elements are modeled.

-

Page 12: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 2 Basic XBRL Processor Information

6

<<interface>>

Link

<<interface>> LinkInformation

Common characteristics for each link are modeled.

Provides about the footnoteLink extended-link-type element.

<<interface>> FootnoteLink

<<interface>> ReferenceLink

<<interface>> RelationLink

<<interface>> LabelLink

<<interface>> CalculationLink

<<interface>> DefinitionLink

<<interface>> PresentationLink

1 *

1 *

Provides about the referenceLink extended-link-type element.

Provides about the labelLink extended-link-type element.

Provides the caliculationLink extended-link-type element.

Provides the definitionLink extended-link-type element.

Provides the presentationLink extended-link-type element.

<<interface>> ResourceLink

Figure 6 Extended link-type element model

Page 13: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 2 Basic XBRL Processor Information

7

2.2.2 Model specific to an instance document

The model specific to an instance document models the individual elements defined for the instance document and their attributes. The figure below shows an outline of the model.

<<interface>>

Instance

<<interface>>Context

<<interface>>Period

<<interface>>Scenario

Context element model

Period element model

<<interface>>Unit

<<interface>> FootnoteLink

Scenario element model

<<interface>>ContextEntity Entity element model

<<interface>>Segment Segment element

model

Unit element model

<<interface>> InstanceElement Items and tuples

<<interface>> Item / Tuple

1 *

1 *

1 *

1 1

1 1

1 1

1 1

1 1

Figure 7 Model specific to instance documents

Page 14: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 2 Basic XBRL Processor Information

8

2.2.3 Model specific to taxonomies

The model specific to taxonomies models the information about links that can be defined in taxonomies and the import function defined in the XML schema. The figure below shows an outline of the model.

<<interface>>

Taxonomy

<<interface>>XMLSchema

<<interface>> PresentationLink

1 *

1 *

<<interface>> CalculationLink 1 *

<<interface>> DefinitionLink 1 *

<<interface>> LabelLink 1 1

<<interface>> ReferenceLink 1 1

Schema directly referenced from an instance document

<<interface>>XMLSchema 1 * Schema imported into another

schema

<<interface>>ElementDecl 1 * "Element" element

Figure 8 Model specific to taxonomies

Page 15: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 2 Basic XBRL Processor Information

9

2.3 Overview of the XBRL Processor

The XBRL processor (com.fujitsu.xml.xbrl.xwand.processor.XBRLProcessor) provides a function that enables XBRL document processing according to XBRL data models.

The XBRL processor facilitates the operations on XBRL data models. 1) Creating an XBRL data model

An XBRL document is created as an XBRL data model. The following functions are provided to create XBRL data models:

- Creating a new XBRL data model - Converting an existing XBRL document into an XBRL data model

2) Saving an XBRL data model XBRL data models can be saved in either of the following formats:

- XBRL document - XBRL data model object (serialization)

3) Referencing data in an XBRL document Data in an XBRL document can be referenced through XBRL data model elements.

4) Modifying data in an XBRL document Data in an XBRL document can be modified by manipulating XBRL data model elements. A function to

set options for processing XBRL documents is provided. The following two types of options are available:

Options that can be specified in the XBRL processor properties A property name defined in XBRLProperties is specified using the method shown below:

- XBRLProcessor.setProperty(String name, Object value) A property name defined in javax.xml.transform.OutputKeys is specified using the method shown

below:

- XBRLProcessor. setOutputProperty(String name, String value) Options that can be specified directly in the XBRL processor

The following options can be specified:

- Setting the error handler XBRLProcessor.setErrorHandler(XBRLErrorHandler errHandler)

- Setting the entity resolver XBRLProcessor.setEntityResolver(XBRLEntityResolver entResolver)

- Setting the taxonomy set resolver XBRLProcessor.setTaxonomySetResolver(TaxonomySetResolver taxSetResolver)

Page 16: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 2 Basic XBRL Processor Information

10

2.4 XBRL Processor Settings

This section explains how to set handlers and resolvers for XBRL Processor.

2.4.1 Setting an error handler

Setting an error handler for XBRL Processor enables collection of errors, warnings, and other information issued during the read or write of an XBRL document.

Implement the XBRLErrorHandler interface to create the error handler.

/** * <p> * This is the handler used to output error, warning, and other information to the standard error output. * </p> */ public class MyErrorHandler implements XBRLErrorHandler { public void error(XBRLProcessorException exception) throws XBRLProcessorException { System.err.println("[ERROR] " + exception.getMessage()); } public void fatalError(XBRLProcessorException exception) throws XBRLProcessorException { System.err.println("[FATAL ERROR] " + exception.getMessage()); } public void warning(XBRLProcessorException exception) throws XBRLProcessorException { System.err.println("[WARNING] " + exception.getMessage()); } public void message(XBRLProcessorException exception) throws XBRLProcessorException { System.err.println("[MESSAGE] " + exception.getMessage()); } }

Set the created handler as shown below:

xbrlProc.setErrorHandler(new MyErrorHandler());

2.4.2 Setting an entity resolver

Setting an entity resolver for XBRL Processor enables resolution of XBRL file external references during read or write of an XBRL document. Use of an entity resolver means that, when an XBRL file references a remote file (for example, http://www.fujitsu.com/xbrl/sample.xsd or similar), a local file (for example, C:¥xbrl¥sample.xsd or similar) is loaded instead of the remote file. Use an entity resolver if the computer running XBRL processor cannot access remote files or if you do not want to access remote files.

Implement the XBRLEntityResolver interface to create the entity resolver.

Page 17: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 2 Basic XBRL Processor Information

11

/** * <p> * This is the resolver for resolving external references. * Set to suit your environment. * </p> * <p> * The resolver created here is used when the read XBRL file (input instance and the schemas and so on that they reference) references a remote file. The resolver is used to read a local file without accessing the remote file. * </p> */ public class MyEntityResolver implements XBRLEntityResolver { // This is the remote file path applied by the resolver. // Modify to suit your environment. private static final String REMOTE_PATH = "http://info.edinet-fsa.go.jp/"; // This is the path to the local file where the above file has been copied. private static final String LOCAL_PATH = "file:///C:/xbrl/edinet/"; // Called when the XBRL file is loaded. public Source resolveInputEntity(String namespace, String sysId) { // The local file stream is returned for references that are presumed to be external references. // This enables processing to continue without accessing remote files. if (sysId != null && sysId.startsWith(REMOTE_PATH)) { // The remote file path is replaced by the local file path. String newSysId = LOCAL_PATH + sysId.substring(REMOTE_PATH.length()); // The file read stream is returned from the local file path. return new StreamSource(newSysId); } return null; } // Called when the XBRL document is written. When a remote file is edited and saved locally, set such that the save destination is returned instead of a null. public Result resolveOutputEntity(String namespace, String sysId) { return null; } }

Set the created resolver as shown below:

xbrlProc.setEntityResolver(new MyEntityResolver());

2.4.3 Setting a taxonomy set resolver

Setting a taxonomy set resolver for XBRL Processor enables resolution of taxonomies during read of an XBRL document. Use of a taxonomy set resolver means that when an XBRL file references an already processed taxonomy, it can be used in a DTS construction without newly reading and analysing the taxonomy. If more than one XBRL file references the same taxonomy, a taxonomy set resolver is used to cache the already processed taxonomy and thereby reduce the processing time for DTS construction.

Implement the TaxonomySetResolver interface to create a taxonomy set resolver.

Page 18: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 2 Basic XBRL Processor Information

12

/** * This is a resolver for caching taxonomies. */ public class MyTaxonomySetResolver implements TaxonomySetResolverEx { private String m_namespace; private TaxonomySet m_taxonomySet; public MyTaxonomySetResolver(String namespace, TaxonomySet taxonomySet) { // Sets the cache. In this example, only one taxonomy is cached, but set to suit your environment such that all the required taxonomies are cached. this.m_namespace = namespace; this.m_taxonomySet = taxonomySet; } // Called if a taxonomy reference is found. public TaxonomySet resolve(String[] xsNsURIs, String[] xsSysIds, String[] lbSysIds) { // If the referenced taxonomy is held in the cache, the cached taxonomy is returned. // In this example, the judgement is based on the namespace name of a single schema but, depending on your environment, set a system identifier including more than one namespace name or linkbase for the judgement. if(this.contains(xsNsURIs, m_namespace)) { return m_taxonomySet; } return null; } // This method is not called. This method is called only if TaxonomySetResolver is implemented rather than TaxonomySetResolverEx. public TaxonomySet resolve(String[] xsSysIds, String[] lbSysIds) { return null; } private boolean contains(String[] xsNsURIs, String namespace) { for(int i=0; i<xsNsURIs.length; i++) { if(namespace.equals(xsNsURIs[i])) { return true; } } return false; } }

Set the created resolver as shown below:

xbrlProc.setTaxonomySetResolver(new MyTaxonomySetResolver(namespace, taxonomySet));

Page 19: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 3 Creating and Saving XBRL Data Models

13

Chapter 3 Creating and Saving XBRL Data Models

3.1 Creating an XBRL Data Model

3.1.1 Creating an XBRL data model

Use the methods shown below to create a new XBRL data model. The methods create an XBRL data

model not having XBRL document information.

- XBRLProcessor.newTaxonomySet()

- XBRLProcessor.newInstance(TaxonomySet taxonomySet) - XBRLProcessor.newInstance(TaxonomySet taxonomySet, java.lang.String sysId)

3.1.2 Converting an existing XBRL document into an XBRL data model

If an XBRL document is converted into an XBRL data model by the XBRL processor, different types of

operations can be performed with the document. The XBRL processor supports the methods explained below to read existing XBRL documents and create

XBRL data models thereof. Each of the methods can read an XBRL document in the desired format as specified with javax.xml.transform.Source for specifying input. During reading of the XBRL document,

the document is checked to verify that it is a valid XBRL document. 1) Reading a taxonomy

The following methods are used to read a taxonomy as an XBRL data model:

- XBRLProcessor.loadTaxonomySet(javax.xml.transform.Source xsSource)

- XBRLProcessor.loadTaxonomySet(javax.xml.transform.Source[] xsSources) - XBRLProcessor.loadTaxonomySet(javax.xml.transform.Source[] xsSources,

javax.xml.transform.Source[] lbSources)

2) Reading an instance document The following methods are used to read an instance document as an XBRL data model:

- XBRLProcessor.loadInstance(javax.xml.transform.Source insSource) - XBRLProcessor.loadInstance(TaxonomySet taxonomySet,

javax.xml.transform.Source insSource)

3.1.3 Creating an XBRL data model from serialized data

An XBRL data model can be saved as an object via serialization, which is explained in a subsequent

section. Serialized object data can be read as an XBRL data model using the method shown below. Furthermore, serialized object data can be read in the desired format as specified in java.io.InputStream for

specifying input. However, the XBRL Processor used for reading must have the same product version number as the XBRL

Processor used for serialization. For example, object data serialized using Interstage XWand 9.0 cannot be read using Interstage XWand 10.0.

XBRLProcessor.deserializeTaxonomySet(java.io.InputStream inStream)

3.1.4 Creating an XBRL data model by reading extended taxonomy additionally

Use the methods shown below to create a new XBRL data model where extended taxonomy information is

added to the existing XBRL data model.

- XBRLProcessor. appendTaxonomySet(TaxonomySet taxonomySet, javax.xml.transform.Source xsSource)

Page 20: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 3 Creating and Saving XBRL Data Models

14

- XBRLProcessor. appendTaxonomySet(TaxonomySet taxonomySet, javax.xml.transform.Source [] xsSources)

- XBRLProcessor. appendTaxonomySet(TaxonomySet taxonomySet, javax.xml.transform.Source [] xsSources, javax.xml.transform.Source [] lbSources)

Using an existing XBRL data model, following process will be improved. These are effective when handling multiple taxonomies having the same base taxonomy in common.

Reduction in reading time of taxonomy The reading time of taxonomy can be shortened by making an XBRL data model of base taxonomy

beforehand and reading only the extended taxonomy in the following processing. Reduction in memory use

By sharing an XBRL data model of base taxonomy, memory consumption will be reduced.

Note : In the above, the XBRL data model of base taxonomy part is read-only.

Page 21: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 3 Creating and Saving XBRL Data Models

15

3.2 Saving an XBRL Data Model

3.2.1 Saving as an XBRL document

An XBRL data model can be saved as an XBRL document as follows:

1) Saving a taxonomy The following methods are used to save a taxonomy from an XBRL data model:

- XBRLProcessor.saveTaxonomy(XMLSchema schema) - XBRLProcessor.saveXMLSchema(XMLSchema schema, javax.xml.transform.Result result)

- XBRLProcessor.saveLinkbase(Linkbase linkbase, javax.xml.transform.Result result)

2) Saving an instance document The following method is used to save an instance document from an XBRL data model:

- XBRLProcessor. saveInstance(Instance instance, javax.xml.transform.Result result)

The prefix of each name (QName) of some elements used in the XBRL document is replaced with an automatically assigned one according to an XBRL processor specification. For details, see Chapter 7,

"Specifications and Restrictions" in this manual.

3.2.2 Serialization

An XBRL data model can be saved not only as an XBRL document and XBRL data model, but also as an

object (serialized data). An XBRL data model can be saved by this way even if the XBRL data model have wrong and can not be saved as an XBRL document.

- XBRLProcessor.serializeTaxonomySet(TaxonomySet taxonomySet, java.io.OutputStream outStream)

Page 22: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 4 Referencing with XBRL Data Models

16

Chapter 4 Referencing with XBRL Data Models

Information about an XBRL document can be obtained from elements of an XBRL data model. The

following three types of elements in XBRL data models can be referenced: Schema

Instance document Link (link base, link in an instance document)

Referencing of each element starts from TaxonomySet or Instance. See Section 3.1.2, "Converting an existing XBRL document into an XBRL data model," and confirm the method of obtaining TaxonomySet

or Instance object. The subsequent descriptions assume that the Instance object is obtained as follows:

Example: Obtain an XBRL data model from the document named sample_instance.xml. XBRLProcessor xbrlProc = new XBRLProcessor(); Instance instance = xbrlProc.loadInstance( new StreamSource("sample_instance.xml")); TaxonomySet taxonomySet = instance.getTaxonomySet()

4.1 Schema

In an XBRL data model, a schema consists of schema information, schema import information, and "element" elements defined in the schema.

One XBRL data model can have multiple schemas. Furthermore, multiple schemas can be imported in one schema. The figure below shows an XBRL document with multiple schemas that involves schema

import relationship between them.

XBRL document

Instance document Schema 1

Schema 2'Item C

Schema 2

Import

<A>100</A> Item A

<B>100</B> Item B

<C>100</C> (Item C)

Figure 9 Relationship between an instance document and importing of schemas

Page 23: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 4 Referencing with XBRL Data Models

17

4.1.1 Referencing a schema

Schema (XMLSchema) A schema is obtained from TaxonomySet by specifying an index with the following method:

Method TaxonomySet.getPrimarySchemas() Example: Refer to a schema. [Sample instance document] <?xml version="1.0" encoding="UTF-8"?> <xbrl ... xsi:schemaLocation="http://www.fujitsu.com/demo/2002-11-11 schema0.xsd http://www.fujitsu.com/demo/2002-11-18 schema1.xsd"> <link:schemaRef ... xlink:href="schema0.xsd"> <link:schemaRef ... xlink:href="schema1.xsd"> ... [Sample program] XMLSchema schema0 = (XMLSchema)taxonomySet.getPrimarySchemas().get(0); XMLSchema schema1 = (XMLSchema)taxonomySet.getPrimarySchemas().get(1); [Results] schema0.getSystemId() : schema0.xsd schema0.getTargetNamespace() : http://www.fujitsu.com/demo/2002-11-11 schema1.getSystemId() : schema1.xsd schema1.getTargetNamespace() : http://www.fujitsu.com/demo/2002-11-18

Indexes are integers beginning from 0 that are used to indicate the sequence in which objects are stored. An integer in the following range can be specified for an index:

0 index < number of objects For every reference procedure with the index specified, a procedure for checking the number of

objects is provided. As a concrete example, the following shows a procedure for checking the number of schemas:

Example: Check the number of schemas. [Example instance document] <?xml version="1.0" encoding="UTF-8"?> <xbrl ... xsi:schemaLocation="http://www.fujitsu.com/demo/2002-11-11 schema0.xsd http://www.fujitsu.com/demo/2002-11-18 schema1.xsd"> <link:schemaRef ... xlink:href="schema0.xsd"> <link:schemaRef ... xlink:href="schema1.xsd"> ... [Sample example] int count = taxonomySet.getPrimarySchemas().size(); [Results] count : 2

Before specifying the index, check the number of objects to confirm that the specified value does

not exceed the number of objects.

Schema importing Imported schemas can be obtained from the schema in which they were imported with the

following method:

Method XMLSchema.getBaseSchemas() Example: Refer to the first schema import information.

Page 24: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 4 Referencing with XBRL Data Models

18

[Sample schema document] <?xml version="1.0" encoding="UTF-8"?> <schema ...> <import namespace="http://www.fujitsu.com/demo/2002-11-18" schemaLocation="sample1.xsd"/> ... [Sample program] XMLSchema schema = (XMLSchema)taxonomySet.getPrimarySchemas().get(0); XMLSchema baseSchema = (XMLSchema)schema.getBaseSchemas().get(0); String namespace = baseSchema.getTargetNamespace(); [Results] namespace : http://www.fujitsu.com/demo/2002-11-18

Schema include Included schemas can be obtained from the schema in which they were included with the following

method:

Method XMLSchema.getIncludedSchemas() Example: Refer to the first schema include information. [Sample schema document] <?xml version="1.0" encoding="UTF-8"?> <schema ...> <include schemaLocation="sample1.xsd"/> ... [Sample program] XMLSchema schema = (XMLSchema)taxonomySet.getPrimarySchemas().get(0); XMLSchema includedSchema = (XMLSchema)schema.getIncludedSchemas().get(0); String namespace = includedSchema.getTargetNamespaceOfIncludingSchema(); [Results] namespace : http://www.fujitsu.com/demo/2002-11-18

To get the included schemas information, following setting is required for XBRLProcessor before reading the taxonomy:

[Sample program] XBRLProcessor xbrlProc = new XBRLProcessor(); xbrlProc.setProperty(XBRLProperties.MERGE_INCLUDED_SCHEMA, XBRLProperties.NO); TaxonomySet taxonomySet = xbrlProc.loadTaxonomySet(...);

Note that if the above setting is not done, included schemas are unified into the schema in which

they were included.

Example: Refer to the first schema include information. -> fail [Sample schema document] <?xml version="1.0" encoding="UTF-8"?> <schema ...> <include schemaLocation="sample1.xsd"/> ... [Sample program] XBRLProcessor xbrlProc = new XBRLProcessor(); TaxonomySet taxonomySet = xbrlProc.loadTaxonomySet(...); XMLSchema schema = (XMLSchema)taxonomySet.getPrimarySchemas().get(0); XMLSchema includedSchema = (XMLSchema)schema.getIncludedSchemas().get(0); -> IndexOutOfBoundsException

Schema referencing using a namespace name A schema in a taxonomy set can be obtained using a namespace name as the key.

Method TaxonomySet.getXMLSchema(String namespace) Example: Refer to the schema of a specific namespace name. [Sample program] XMLSchema schema =

Page 25: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 4 Referencing with XBRL Data Models

19

(XMLSchema)taxonomySet. getXMLSchema ("http://www.fujitsu.com/demo/2002-11-18"); String namespace = schema.getTargetNamespace(); [Results] namespace : http://www.fujitsu.com/demo/2002-11-18

All schemas

All schemas in a taxonomy set can be obtained.

Method TaxonomySet.getAllSchemas()

4.1.2 Referring to "element" elements

"Element" elements are defined for individual schemas. Referencing from a schema

"Element" elements can be referenced from XMLSchema by using an index.

Method XMLSchema.getElementDecls() Example: Refer to the element at the beginning of the document. [Sample document] <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" ...> <element id="cash" name="cash" ... type="xbrli:monetaryItemType" substitutionGroup="xbrli:item"/> ... [Sample program] XMLSchema schema = (XMLSchema)taxonomySet.getPrimarySchemas().get(0); ElementDecl element = schema.getElementDecls().get(0); [Results] element.getId() : cash element.getName() : cash

An "element" element is an item definition element, tuple definition element or other definition element. The type of element can be determined by using the following method:

Method ElementDecl.isItemDecl() ElementDecl.isTupleDecl() Example: Determine the type of the XBRL element. if(element.isItemDecl()) { ...(Processing)... }

Referencing with a name or id

An "element" element can be referenced from XMLSchema by specifying an index. For ease of use, a reference procedure using a specified name or id is provided.

Method XMLSchema.getElementDeclByName(String name) XMLSchema.getElementDeclById(String id) Example: Refer to the cash account elements. [Sample document]

Page 26: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 4 Referencing with XBRL Data Models

20

<?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" <element id="cash" name="cash" ... type="xbrli:monetaryItemType" substitutionGroup="xbrli:item"/> ... [Sample program] XMLSchema schema = (XMLSchema)taxonomySet.getPrimarySchemas().get(0); ElementDecl element = schema.getElementDeclByName("cash"); [Results] element.getId() : cash element.getName() : cash

If no element with the specified name or id is found , null is returned.

Attribute of an item definition element

Of "element" elements, the item definition elements have the balance attribute and periodType attribute.

Method ElementDecl.getBalance() ElementDecl.getPeriodType() Example: Obtain the balance attribute. [Sample document] <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" <element id="cash" name="cash" xbrli:balance="debit" ... type="xbrli:monetaryItemType" substitutionGroup="xbrli:item"/> ... [Sample program] if(element.isItemDecl()) { String balance = element.getBalance(); //Acquisition of balance attribute } [Results] balance : debit

The above explanation covers an attribute which is used only in item definition elements. For information about other attributes used by "element" elements, see the "XBRL API Reference"

Values assigned to items by using instance documents can be obtained with the Item method, not with ElementDecl. The next section covers this in detail.

Page 27: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 4 Referencing with XBRL Data Models

21

4.2 Instance Document

In an XBRL data model, an instance document consists of document information (Instance), item information, values assigned to items (Item), and context.

4.2.1 Referencing instance information

To reference instance document information, use the method defined in Instance.

Example: Refer to instance document information. String sysId = instance.getSystemId();

4.2.2 Referencing context and unit

When a value is assigned to an item in an XBRL document, attribute information can be set. The attribute information is referred to as context. The context is coded separately from an item and is referenced from

the item. Coding the context separately enables the reuse of the same group of attributes. In the XBRL2.1 Specification, a unit is coded separately from the context.

Referencing a context A context is coded in an instance document. It can be referenced from Instance by specifying an

index.

Method Instance.getContexts() Example: [Sample document] <?xml version="1.0" encoding="UTF-8"?> <xbrl ...> ... <context id="context1"> <entity> <identifier scheme="http://www.fujitsu.com/demo/2002-11-11">demo1</identifier> </entity> <period> <instant>2002-11-11</instant> </period> </numericContext> ... [Sample program] Context context = instance.getContexts().get(0); [Results] context.getId() : context1

Context sub-elements

A context has three sub-elements: entity (XBRLEntity), period, and scenario. These sub-elements are handled as classes in an XBRL data model.

Method Context.getEntity() Context.getScenario() Context.getPeriod() Example: ContextEntity entity = context.getEntity(); // Entity acquisition Scenario scenario = context.getScenario(); // Scenario acquisition Period period = context.getPeriod(); // Period acquisition

Page 28: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 4 Referencing with XBRL Data Models

22

The entity and period elements are always required. For details about individual elements, see the

"XBRL API Reference".

Referencing a unit A unit is coded in an instance document. It is referenced from Instance by specifying an index.

Method Instance.getUnits() Example: [Sample document] <?xml version="1.0" encoding="UTF-8"?> <xbrl ...> ... <unit id="unit1"> <measure>ISO4217:JPY</measure> </unit> ... [Sample program] Unit unit = instance.getUnits().get(0); [Results] unit.getId() : unit1

4.2.3 Referencing item values

An item value is data assigned by an instance document to an item definition element defined in a

taxonomy. Referencing values

The procedure for referencing values has the following format:

Method Item.getSpecifiedValue() Example: Refer to a value. 1 [Sample document] <?xml version="1.0" encoding="UTF-8"?> <xbrl ...> <fj:Name contextRef="context2" xml:lang="ja"> Fujitsu Kabushikigaishya</fj:Name> <fj:Name contextRef="context2" xml:lang="en">Fujitsu Ltd.</fj:Name> [Sample program] Item item0 = (Item)instance.getChildren().get(0); Item item1 = (Item)instance.getChildren().get(1); String value0 = item0.getSpecifiedValue(); String value1 = item1.getSpecifiedValue(); [Results] value0 : Fujitsu Ltd. value1 : Fujitsu

An item can be obtained from the tree having Instance as the root. In the above example, the first and second children of Instance are obtained as items because two items exist right under the root.

Item type

Items are numeric or non-numeric. The type of an item can be checked by using the following method to compare the item with the InstanceElement constant:

Page 29: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 4 Referencing with XBRL Data Models

23

Method Item.getElementType() Example: Determine the type of item. if(item.getElementType() == InstanceElement.ELEMENT_TYPE_NUMERIC_ITEM) { NumericItem nItem = (NumericItem)item; ...(Processing)... }

A non-numeric type can be cast to NonNumericItem to obtain the language attribute.

Method NonNumericItem.getLanguage() Example: Obtain the language attributes of nonnumeric items. [Sample document] <?xml version="1.0" encoding="UTF-8"?> <xbrl ...> <fj:Name contextRef="context2" xml:lang="ja">Fujitsu Kabushikigaishya</fj:Name> <fj:Name contextRef="context2" xml:lang="en">Fujitsu Ltd.</fj:Name> [Sample program] NonNumericItem nnItem0 = (NonNumericItem)item0; NonNumericItem nnItem1 = (NonNumericItem)item1; String lang0 = nnItem0.getLanguage(); String lang1 = nnItem1.getLanguage(); [Results] lang0 : ja lang1 : en

However, the language attribute is not always defined. For example, a business entity such as a date is a nonnumeric value, but the language attribute may not be defined for it because the format

of that business entity is determined in the XBRL2.1 Specification and does not depend on the language.

A numeric type can be cast to NumericItem to obtain a calculated value.

Method NumericItem.getCalculatedValue() Example: Obtaine a calculated value. [Sample document] <?xml version="1.0" encoding="UTF-8"?> <xbrl ...> <fj:cash contextRef="context1" ...>10000</fj:Name> <fj:cash contextRef="context1" ...>80</fj:Name> ... [Sample program] NumericItem nItem0 = (NumericItem)item0; NumericItem nItem1 = (NumericItem)item1; NumericValue value0 = nItem0.getCalculatedValue(); NumericValue value1 = nItem1.getCalculatedValue(); [Results] (The calculation results depend on the calculation link definition)

A procedure for actual calculation is described in a subsequent section.

Page 30: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 4 Referencing with XBRL Data Models

24

4.3 Links

Links provide a function for describing the interrelationships between XBRL elements and a function for specifying a resource for an XBRL element or item.

Links are classified into two categories: tree-structured links and map-structured links. A tree-structured link is used to describe the interrelationships between XBRL elements. When resources are specified,

links are configured as a map of resources for XBRL elements or items. The figures below illustrate the two types of links.

Linkbase document XBRL document

XBRL element A

XBRL element B

XBRL element C

XBRL element D

. . .

Link 1XBRL element A

Link 2XBRL element B

Link 3XBRL element C

Link 4XBRL element D

Figure 10 Relation links

Linkbase document XBRL document

XBRL element A

XBRL element B

XBRL element C

XBRL element D

. . .

Link Resources XBRL element A XBRL element B XBRL element C

A

a

B

i

C

u

Figure 11 Resource links

Page 31: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 4 Referencing with XBRL Data Models

25

4.3.1 Linkbase information

A linkbase document provides a taxonomy with a link structure and data. Information about links can be stored separately from schemas as separate documents.

Referencing linkbase information The XBRLDocument class provides a procedure for referencing linkbase information. To

reference linkbase information, use the method that is appropriate for the type of schema or instance document.

Method XBRLDocument.getLinkbases(short linkType) Example: [Sample document] <?xml version="1.0" encoding="UTF-8"?> <schema ...> <annotation> <appinfo> <link:linkbaseRef xlink:type="simple" xlink:actuate="onRequest" xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase" xlink:href="link_presentation.xml" xlink:role="http://www.xbrl.org/2003/role/presentationLinkbaseRef"/> ... </appinfo> </annotation> ... [Sample program] XMLSchema schema = (XMLSchema)taxonomySet.getPrimarySchemas().get(0); Linkbase linkbase = (Linkbase)schema.getLinkbases(Link.LINK_TYPE_PRESENTATION).get(0); [Results] linkbase.getSystemId() : link_presentation.xml

All linkbases

To reference all linkbase information in the TaxonomySet, use the method of TaxonomySet.

Method TaxonomySet.getAllLinkbases(short linkType)

4.3.2 Link and link information

Link Link comprises the node entities that constitute a link. Its primary function is to store references

to XBRL elements, other links and resource objects. The link data handling procedure itself becomes a reference to a link. See the next section for information on the reference procedure.

LinkInformation LinkInformation represents the relationships between other links and resource objects stored in a

link. This information is required for configuring a link or determining the type of connection to a link. See the next section for information on the reference procedure.

Anchor Anchor is an XBRL element or item that is associated with a link.

LinkModel LinkModel is a model to handle Link and LinkInformation.

4.3.3 Referencing a relation link

To reference an XBRL element according to specified relationships, a link need first be referenced before

Page 32: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 4 Referencing with XBRL Data Models

26

the XBRL element is referenced from the link. Referencing a link

To reference the node entity of a relation link, specify an index with TaxonomySet.

Method TaxonomySet.getRootPresentationLinks() TaxonomySet.getRootCalculationLinks() TaxonomySet.getRootDefinitionLinks() TaxonomySet.getRootRelationLinks(short linkType) Example: [Sample document] link_presentaion.xml <?xml version="1.0" encoding="UTF-8"?> <linkbase ...> <presentationLink xlink:type="extended" ...> <loc xlink:type="locator" xlink:href="demo3_balancesheet.xsd#Document" xlink:label="src"/> ... </presentationLink> ... [Sample program] PresentationLink rootLink = (PresentationLink)taxonomySet.getRootPresentationLinks().get(0); [Results] rootLink.getAnchor() : XBRL element"Document" (The RelationLink.getAnchor() method is explained later)

Although a relation link has a tree structure, only the node that becomes the root of the tree can be

referenced from the TaxonomySet object. Subnodes under the root are acquired with the RelationLink.getChildren() method of each link.

Method RelationLink.getChildren() Example: Refer to children nodes. [Sample document] <?xml version="1.0" encoding="UTF-8"?> <linkbase ...> <presentationLink xlink:type="extended" ...> <loc xlink:type="locator" xlink:href="demo3_balancesheet.xsd#Document" xlink:label="src"/> <loc xlink:type="locator" xlink:href="demo3_balancesheet.xsd#Company" xlink:label="dest"/> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="src" xlink:to="dest" .../> ... </presentationLink> <presentationLink xlink:type="extended" ...> <loc xlink:type="locator" xlink:href="demo3_balancesheet.xsd#Document" xlink:label="src"/> <loc xlink:type="locator" xlink:href="demo3_balancesheet.xsd#Title" xlink:label="dest"/> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="src" xlink:to="dest" .../> ... </presentationLink> ... [Sample program] PresentationLink rootLink =

Page 33: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 4 Referencing with XBRL Data Models

27

(PresentationLink)taxonomySet.getRootPresentationLinks().get(0); PresentationLink childLink0 = (PresentationLink)rootLink.getChildren().get(0); PresentationLink childLink1 = (PresentationLink)rootLink.getChildren().get(1); [Results] childLink0.getAnchor() : XBRL element"Company" childLink1.getAnchor() : XBRL element"Title"

When you want to split the tree structure of relation link according to its extended link role or arcrole, specify the extended link role or arcrole to get the root node.

Method TaxonomySet.getRootPresentationLinks(String role, String arcrole) TaxonomySet.getRootPresentationLinks(RelationLinkFilter filter, String role, String arcrole) TaxonomySet.getRootCalculationLinks(String role, String arcrole) TaxonomySet.getRootCalculationLinks(RelationLinkFilter filter, String role, String arcrole) TaxonomySet.getRootDefinitionLinks(String role, String arcrole) TaxonomySet.getRootDefinitionLinks(RelationLinkFilter filter, String role, String arcrole) TaxonomySet.getRootRelationLinks(short linkType, String role, String arcrole) TaxonomySet.getRootRelationLinks(short linkType, RelationLinkFilter filter, String role, String arcrole) Example: [Sample document] link_presentaion.xml <?xml version="1.0" encoding="UTF-8"?> <linkbase ...> <presentationLink xlink:type="extended" xlink:role="http://www.fujitsu.com/xbrl/document1"...> <loc xlink:type="locator" xlink:href="demo3_balancesheet.xsd#Document" xlink:label="src"/> ... </presentationLink> ... [Sample program] PresentationLink rootLink = (PresentationLink)taxonomySet. getRootPresentationLinks("http://www.fujitsu.com/xbrl/document1", null).get(0); [Results] rootLink.getAnchor() : XBRL element "Document"

Subnodes under the root are acquired with the call of RelationLink.getChildModels(RelationLinkFilter filter, String role, String arcrole) method etc.

Method RelationLink.getChildModels(RelationLinkFilter filter, String role, String arcrole) ElementDecl.getChildRelationLinkModels(short linkType, RelationLinkFilter filter, String role, String arcrole) Example: [Sample document] <?xml version="1.0" encoding="UTF-8"?> <linkbase ...> <presentationLink xlink:type="extended" xlink:role="http://www.fujitsu.com/xbrl/document1" ...> <loc xlink:type="locator" xlink:href="demo3_balancesheet.xsd#Document" xlink:label="src"/> <loc xlink:type="locator" xlink:href="demo3_balancesheet.xsd#Company" xlink:label="dest"/> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="src" xlink:to="dest" .../> ...

Page 34: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 4 Referencing with XBRL Data Models

28

</presentationLink> <presentationLink xlink:type="extended"

xlink:role="http://www.fujitsu.com/xbrl/document2" ...> <loc xlink:type="locator" xlink:href="demo3_balancesheet.xsd#Document" xlink:label="src"/> <loc xlink:type="locator" xlink:href="demo3_balancesheet.xsd#Title" xlink:label="dest"/> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="src" xlink:to="dest" .../> ... </presentationLink> ... [Sample program] PresentationLink rootLink = (PresentationLink)taxonomySet.getRootPresentationLinks(null, "http://www.fujitsu.com/xbrl/document1", null).get(0); RelationLinkModel childModel0 = (RelationLinkModel)rootLink.getChildModels(null, "http://www.fujitsu.com/xbrl/document1", null).get(0); RelationLinkModel childModel1 = (RelationLinkModel)rootLink.getChildModels(null, "http://www.fujitsu.com/xbrl/document1", null).get(1); -> IndexOutOfBoundsException [Results] childModel0.getParentRelationLink().getAnchor() : XBRL element "Document" childModel0.getChildRelationLink().getAnchor() : XBRL element "Company"

Use the method below if you want to get root and child node information grouped separately for each extended link role. If you need to follow all the links for each extended link role, this enables

faster processing than repeatedly calling TaxonomySet.getRoot~Links() or RelationLink.getChildModels(). Information can also be obtained concerning the extended link

roles that exist in a link.

Method TaxonomySet.getRelationLinkMap(short linkType) Example: [Sample program] RelationLinkMap map = taxonomySet.getRelationLinkMap(Link.LINK_TYPE_PRESENTATION); Enumeration roles = map.getRoles(); while (roles.hasMoreElements()) { String role = (String)roles.nextElement(); RelationLink rootLink = (RelationLink)map.getRootRelationLinks(role).get(0); RelationLinkModel childModel = (RelationLinkModel)map.getChildModels(role, rootLink).get(0); ...(Getting recursive child nodes, and so on)... }

Referencing an element that becomes an anchor To reference the element that becomes a link anchor, do as follows:

Method RelationLink.getAnchor() Example: [Sample document] <?xml version="1.0" encoding="UTF-8"?> <linkbase ...> <presentationLink xlink:type="extended" ...> <loc xlink:type="locator" xlink:href="demo3_balancesheet.xsd#Document" ... [Sample program]

Page 35: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 4 Referencing with XBRL Data Models

29

ElementDecl element = (ElementDecl)rootLink.getAnchor(); [Results] element.getId() : Document

Referencing link information

A relation link represents the relationships between elements as link information. Examples of

important attributes in the relationships are the order attribute for each link and the weight attribute for calculation links. The figure below shows the procedure for obtaining the order attribute.

Method Arc.getOrder() CalculationArc.getWeight() PresentationArc.getPreferredLabel() Example: Obtain the order attribute of a presentation link. LinkInformation linkInfo = rootLink.getLinkInformationList(childLink0).get(0); Arc arc = linkInfo.getArc(); if(arc.getArcType() == Link.LINK_TYPE_PRESENTATION){ PresentationArc presArc = (PresentationArc)arc; double order = presArc.getOrder(); }

Referencing a link model

The procedure for getting links and link information from a link model is shown below:

Method LinkModel.getLinkInformation() RelationLinkModel.getParentRelationLink() RelationLinkModel.getChildRelationLink() Example: Get the parent and child of a presentation link. RelationLink parentLink = childModel0.getParentRelationLink(); RelationLink childLink = childModel0.getChildRelationLink(); LinkInformation linkInfo = childModel0.getLinkInformation();

4.3.4 Referencing a resource link

To reference the resource specified for an XBRL element, reference the link and the XBRL element before

obtaining the resource assigned to the XBRL element (anchor) from the referenced link. Use the same procedure to refer to the resource assigned to an item (anchor).

Referring to a link The XBRL processor assumes that TaxonomySet or Instance has one resource link node entity.

The label, reference, and footnote links can be referenced with the corresponding methods.

Method TaxonomySet.getLabelLink() TaxonomySet.getReferenceLink() Instance.getFootnoteLink() Example: LabelLink labelLink = taxonomySet.getLabelLink(); ReferenceLink refLink = taxonomySet.getReferenceLink(); FootnoteLink footLink = instance.getFootnoteLink();

Referencing resources

Link is referenced for resources allocated to elements. These elements are assumed to have already been obtained individually as a variable name element or item.

Page 36: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 4 Referencing with XBRL Data Models

30

Method LabelLink.getResources(Anchor element) ReferenceLink.getResources(Anchor element) FootnoteLink.getResources(Anchor item) Example: Label label = (Label)labelLink.getResources(element).get(0);

When you want to get the resources according to its extended link role or arcrole, specify the extended link role or arcrole to get the resources.

Method LabelLink.getResourceModels(Anchor anchor, ResourceLinkFilter filter, String role, String arcrole) ReferenceLink.getResourceModels(Anchor anchor, ResourceLinkFilter filter, String role, String arcrole) FootnoteLink.getResourceModels(Anchor anchor, ResourceLinkFilter filter, String role, String arcrole) ElementDecl.getResourceLinkModels(short linkType, ResourceLinkFilter filter, String role, String arcrole) ElementDecl.getResourceLinkModels(short linkType, ResourceLinkFilter filter, String role, String arcrole, String resRole, String lang) Example: ResourceLinkModel label = (ResourceLinkModel)labelLink.getResourceModels(element, null, "http://www.fujitsu.com/xbrl/document1" ,null).get(0); Label label = (Label)labelModel.getResource();

Using resources

Resource information (value and language attribute) is obtained from the resource class.

Method Label.getLabelElements() Label.getLabelElementsAsString() Label.getLanguage() Example: Obtain labels written in Japanese. [Sample document] <label xlink:type="resource" xlink:label="label" xml:lang="ja">Syamei</label> [Sample program] if(...){ String labelValue = label.getLabelElementsAsString(); // Reference to the label value String lang = label.getLanguage(); // Reference to label language attribute } [Results] labelValue : Syamei lang : ja

Referencing link model

Link and LinkInformation are obtained from the link model.

Method LinkModel.getLinkInformation() ResourceLinkModel.getResourceLink() ResourceLinkModel.getAnchor() ResourceLinkModel.getResource() Example: Obtain label and anchor. ElementDecl element = (ElementDecl)labelModel.getAnchor(); Label label = (Label)labelModel.getResource(); LinkInformation linkInfo = labelModel.getLinkInformation();

4.3.5 Executing calculations and referencing calculation results via calculation links

As explained in a previous section, calculation results can be referenced via a calculation

Page 37: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 4 Referencing with XBRL Data Models

31

link by using the getCalculatedValue method of a numeric item (NumericItem). Calculation values can be calculated automatically with the following procedure:

Method NumericItem.calculate() NumericItem.calculate(int roundingMode) NumericItem.calculate(java.lang.String role) NumericItem.calculate(java.lang.String role, int roundingMode) NumericItem.calculate(java.lang.String role, CalculationOption option)

Calculations are automatically made according to the calculation rules specified in the XBRL2.1

Specification. Calculations are also automatically made for the calculation child and descendant items of the item for which the calculate method was executed. Some calculation rules can be

changed by specifying CalculationOption.

4.3.6 Referencing links where overriding is resolved

The XBRL Processor provides two types of procedures: One is a reference procedure that resolves the overriding of links; the other is a reference procedure that does not resolve the overriding of links. The method that resolves overriding is shown below. Refer to Section 5.4, "Overriding Links", for details of the overriding of links.

Method that resolves overriding of link information RelationLink.getResolvedLinkInformationList(RelationLink child, String role, String arcrole)

ResourceLink.getResolvedLinkInformationList(Anchor anchor, Resource resource,

String role, String arcrole)

Method that uses filters to resolve overriding RelationLink.getChildModels(RelationLinkFilter filter, String role, String arcrole) RelationLink.getParentModels(RelationLinkFilter filter, String role, String arcrole)

RelationLink.getRelationLinkByAnchor(Anchor anchor, RelationLinkFilter filter,

String role, String arcrole) ResourceLink.getResourceModels(Anchor anchor, ResourceLinkFilter filter,

String role, String arcrole)

ElementDecl.getChildRelationLinkModels(short linkType, RelationLinkFilter filter,

String role, String arcrole)

ElementDecl.getResourceLinkModels(short linkType, ResourceLinkFilter filter,

String role, String arcrole, String resRole, String lang)

UserElement.getResourceLinkModels(short linkType, ResourceLinkFilter filter,

String role, String arcrole, String resRole, String lang)

Appendix B, "Samples of Overridden Documents"", contains actual examples of referencing an XBRL document that contains overriding. Refer to the examples.

Page 38: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 5 Modifying with XBRL Data Models

32

Chapter 5 Modifying with XBRL Data Models

Information about XBRL documents can be changed by manipulating elements of the corresponding XBRL

data model. Changes to an XBRL data model are classified into the following three categories:

1) Adding a new element 2) Changing the contents of an existing element

3) Deleting an existing element

5.1 Adding a New Element

In an XBRL data model, objects that contain individual elements basically provide setting and addition

methods for these sub-elements. Each created element also provides a setting method for itself. The figure below shows the basic workflow for adding new elements to an XBRL data model.

:User application :A

createB()

High-order element

:B Low-order element setAny()

setB()

Figure 12 Basic workflow for adding new elements to an XBRL data model

For example, the Identifier of an instance document, which is a sub-element as viewed from ContextEntity,

can be created and set as follows: 1) Create an Identifier instance using Instance.createIdentifier() or Instance.createIdentifier(String value,

String scheme). 2) Specify the setting of the Identifier instance created in step 1), by calling setScheme(String scheme)

or setValue(String value). 3) Using ContextEntity.setIdentifier(Identifier identifier), specify the Identifier instance set up in step 2)

to be a ContextEntity instance.

Page 39: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 5 Modifying with XBRL Data Models

33

5.2 Changing the Contents of an Existing Element

To change a specific item in an XBRL document, change the settings of elements in the corresponding XBRL data model. For example, to change the value of the balance attribute of an item definition element,

use the following method from the applicable ElementDecl instance to change the settings: ElementDecl.setBalance(String balance)

5.3 Deleting an Existing Element

To delete a specific element from an XBRL document, delete an element in the corresponding XBRL data model. For example, to delete the "element" element in a schema, delete the corresponding ElementDecl

instance from its upper-level element XMLSchema instance, using the following method: XMLSchema.removeElementDecl(ElementDecl element)

Page 40: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 5 Modifying with XBRL Data Models

34

5.4 Overriding Links

Link overriding is implemented by adding a new structural element, rather than by deleting an existing structural element or mofidying its contents. The following sections give an overview and describe the procedure.

5.4.1 Link overriding

In an XBRL document, different types of link information can be assigned to a single link. It is also possible to define multiple links that are assumed to be identical to one another. These definitions are not

restricted to the same document. Links and link information can be assigned for different documents. Based on the above specifications, once links are created, they can be replaced without deletion or

modification of their contents. This function is referred to as "override". The override function enables flexible extension of XBRL documents. For example, link information contains information such as

whether link traversal is enabled, the element presentation order, and accrual weight used for item calculations. The presentation order and accrual weight can be changed according to the situation in which

XBRL documents are used. Two steps, link deletion and link addition, are required to override a link.

Link 1: Defined in base taxonomy

Links 2 and 3: Defined in extended taxonomy

* Link overriding causes order=1 to become order=3.

XBRL element <A/> XBRL element <B/>

Link informatio

Link 1 (order=1)

Link 2 (deletes Link 1)

Link 3 (order=3)

Figure 13 Overriding of the link information

5.4.2 Creating a process for overriding

The following shows an example of creating a process for the overriding of information in an XBRL

processor data model:

Example: Create a process of overriding. //Call the link to be overridden. RelationLink parentLink = (RelationLink)taxonomySet.getRootPresentationLinks().get(0); RelationLinkModel oldChildModel = (RelationLinkModel)parentLink.getChildModels( RelationLink.FILTER_RESOLVING, null, null).get(0); RelationLink childLink = oldChildModel.getChildRelationLink(); LinkInformation oldLinkInfo = oldChildModel.getLinkInformation(); Arc oldArc = oldLinkInfo.getArc(); //Create the XLink declaration information of the link. Linkbase linkbase = (Linkbase)schema.getLinkbases(Link.LINK_TYPE_PRESENTATION).get(0); XLinkDecl xDecl = linkbase.createXLinkDecl(); linkbase.addXLinkDecl(xDecl);

Page 41: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 5 Modifying with XBRL Data Models

35

//Create the link information that deletes the existing link. LinkInformation proLinkInfo = oldLinkInfo.clone(xDecl); proLinkInfo.getArc().setPriority(oldArc.getPriority() + 1); proLinkInfo.getArc().setUse(Arc.USE_PROHIBITED); proLinkInfo.getSrcLocator().setLabel("src1"); proLinkInfo.getDestLocator().setLabel("dest1"); //Register the link information xDecl.addLinkInformation(proLinkInfo); parentLink.addLinkInformation(childLink, proLinkInfo); //Create the link information that raises the order of the existing link. LinkInformation oveLinkInfo = oldLinkInfo.clone(xDecl); oveLinkInfo.getArc().setPriority(oldArc.getPriority() + 2); oveLinkInfo.getArc().setOrder(oldArc.getOrder() + 1); oveLinkInfo.getSrcLocator().setLabel("src2"); oveLinkInfo.getDestLocator().setLabel("dest2"); //Register the link information xDecl.addLinkInformation(oveLinkInfo); parentLink.addLinkInformation(childLink, oveLinkInfo);

Overriding can also be implemented as shown below:

Example: Create a process of overriding. //Call the link to be overridden. RelationLink parentLink = (RelationLink)taxonomySet.getRootPresentationLinks().get(0); RelationLinkModel oldChildModel = (RelationLinkModel)parentLink.getChildModels( RelationLink.FILTER_RESOLVING, null, null).get(0); ElementDecl pElem = (ElementDecl)oldChildModel.getParentRelationLink().getAnchor(); ElementDecl cElem = (ElementDecl)oldChildModel.getChildRelationLink().getAnchor(); Arc oldArc = oldChildModel.getLinkInformation().getArc(); //Create the XLink declaration information of the link. Linkbase linkbase = (Linkbase)schema.getLinkbases(Link.LINK_TYPE_PRESENTATION).get(0); XLinkDecl xDecl = linkbase.createXLinkDecl(); linkbase.addXLinkDecl(xDecl); //Delete the existing link. oldChildModel.prohibitLink(xDecl); //Create and add the link that is the existing link with its order raised. RelationLinkModel childModel = pElem.addChild(Link.LINK_TYPE_PRESENTATION, cElem, xDecl, oldArc.getArcrole()); LinkInformation oveLinkInfo = childModel.getLinkInformation(); oveLinkInfo.getArc().setOrder(oldArc.getOrder() + 1);

Note that link deletion and link addition are both necessary in order to override a link.

Page 42: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 6 Tutorial

36

Chapter 6 Tutorial

This chapter explains how to use the XBRL processor by providing detailed examples:

1) Creating new TaxonomySet 2) Adding a schema to TaxonomySet

3) Importing xbrl-instance.xsd 4) Adding an "element" element to a schema

5) Adding a link to linkbase 6) Creating an instance and adding an item

7) Saving an XBRL document

6.1 Creating a new TaxonomySet

In this step, we create a new TaxonomySet using the XBRL processor. The following creates a

TaxonomySet that has no information:

XBRLProcessor xbrlProc = new XBRLProcessor(); //Create new TaxonomySet. TaxonomySet taxonomySet = xbrlProc.newTaxonomySet();

6.2 Adding a Schema

Here, a schema (XMLSchema) is added to the TaxonomySet according to the following procedure: 1) Creation with the TaxonomySet

2) Making the required settings effective 3) Addition to the TaxonomySet

//Create and specify a schema. XMLSchema schema = taxonomySet.createXMLSchema(); schema.setSystemId(xsSysId); schema.setTargetNamespace("http://www.fujitsu.com/xbrl/sample"); schema.putNamespacePrefix("http://www.fujitsu.com/xbrl/sample", "fj"); schema.getUserAttrs().setAttribute("", "elementFormDefault", "qualified"); taxonomySet.addPrimarySchema(schema);

6.3 Importing xbrl-instance.xsd

xbrl-instance.xsd needs to be directly or indirectly imported into a taxonomy schema contained in TaxonomySet.

//Import xbrl-instance.xsd. try { schema.addBaseSchema(xbrlProc. getXBRLInstanceSchema(taxonomySet)); } catch (Exception e) { }

Page 43: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 6 Tutorial

37

6.4 Adding an "Element" Element

In this step, we add an "element" element to a schema. Here, an element declaration of the item to be used for an instance is added.

//Add an "element" element. ElementDecl element = schema.createElementDecl(); element.setId("sample_id"); element.setName("sample_name"); element.setPeriodType(ElementDecl.PERIOD_TYPE_INSTANT); element.setType(ElementDecl.XBRL_INSTANCE_NS_URI, ElementDecl.TYPE_MONETARY_ITEM); element.setSubstitutionGroup(ElementDecl.XBRL_INSTANCE_NS_URI, ElementDecl.SUB_GROUP_ITEM); schema.addElementDecl(element); ElementDecl element2 = schema.createElementDecl(); element2.setId("sample_id2"); element2.setName("sample_name2"); element2.setPeriodType(ElementDecl.PERIOD_TYPE_INSTANT); element2.setType(ElementDecl.XBRL_INSTANCE_NS_URI, ElementDecl.TYPE_MONETARY_ITEM); element2.setSubstitutionGroup(ElementDecl.XBRL_INSTANCE_NS_URI, ElementDecl.SUB_GROUP_ITEM); schema.addElementDecl(element2);

6.5 Adding a Link

Add a link.

The procedure for adding a relation link differs from that for adding a resource link. For the relation link, the registration procedure differs between the root link and sublinks. If only the root link exists, creation

of the link entity is omitted.

6.5.1 Adding a relation link

//Add a link. //Register a presentation link reference. Linkbase linkbase = taxonomySet.createLinkbase(); linkbase.setSystemId("link_presentaion.xml"); schema.addLinkbase(Link.LINK_TYPE_PRESENTATION, linkbase); //Create a link. PresentationLink pLink = taxonomySet.createPresentationLink(); //Specify an element in the link node. pLink.setElementDecl(element); //Register the link as the root. taxonomySet.addRootPresentationLink(pLink); //Create link containing a link registration element. PresentationLink childLink = taxonomySet.createPresentationLink(); childLink.setElementDecl(element2); pLink.addChild(childLink); XLinkDecl xDecl = linkbase.createXLinkDecl(); linkbase.addXLinkDecl(xDecl); PresentationArc arc = xDecl.createPresentationArc(); arc.setArcrole(PresentationArc.ARCROLE_PARENT_CHILD); arc.setOrder(10); Locator srcLoc = xDecl.createPresentationLocator();

Page 44: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 6 Tutorial

38

srcLoc.setLabel("src"); Locator destLoc = xDecl.createPresentationLocator(); destLoc.setLabel("dest"); LinkInformation linkInformation = xDecl.createLinkInformation(srcLoc, destLoc, arc); xDecl.addLinkInformation(linkInformation); pLink.addLinkInformation(childLink, linkInformation);

6.5.2 Adding a resource link

//Register a label link reference. Linkbase linkbase2 = taxonomySet.createLinkbase(); linkbase2.setSystemId("link_label.xml"); schema.addLinkbase(Link.LINK_TYPE_LABEL, linkbase2); LabelLink lLink = taxonomySet.getLabelLink(); //Create a label resource. Label label = taxonomySet.createLabel(); label.setLanguage("ja"); label.setLabelElementsAsString("TEST"); //Add the link destination resource to link. lLink.addLabel(element, label); //Create link information. XLinkDecl xDecl2 = linkbase2.createXLinkDecl(); linkbase2.addXLinkDecl(xDecl2); LabelArc arc2 = xDecl2.createLabelArc(); arc2.setArcrole(LabelArc.ARCROLE_CONCEPT_LABEL); Locator srcLoc2 = xDecl2.createLabelLocator(); srcLoc2.setLabel("element"); Locator destLoc2 = xDecl2.createLabelLocator(); destLoc2.setLabel("label"); destLoc2.setRole(LabelLocator.ROLE_LABEL); LinkInformation linkInformation2 = xDecl2.createLinkInformation(srcLoc2, destLoc2, arc2); xDecl2.addLinkInformation(linkInformation2); //Register link information. lLink.addLinkInformation(element, label, linkInformation2);

6.6 Creating an Instance and Adding an Item

1) Creating an instance Here, we create an instance using the TaxonomySet as a basis. A prefix needs to be registered for

the namespace URI used in an instance document.

//Create and specify an instance. Instance instance = null; try { instance = xbrlProc.newInstance(taxonomySet); } catch (XBRLProcessorException e) { System.err.println("creation error: " + e.getMessage()); } instance.setSystemId(insSysId); //Register a prefix. instance.putNamespacePrefix("http://www.fujitsu.com/xbrl/sample", "fj"); instance.putNamespacePrefix("http://www.xbrl.org/2003/iso4217", "ISO4217");

Page 45: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 6 Tutorial

39

2) Adding an item We add an item to the instance. To do so, we create the item using as a basis the element

declaration defined in the schema.

//Add an item. NumericItem nItem = instance.createNumericItem(element); instance.addChild(nItem);

3) Adding item information

Here, item information is added. At this point, we add the items listed below to the location immediately following the root element

of the instance document. Item value: 100

Significant figure: 18 digits Unit: ISO4217:JPY

Date: December 14, 2001 Entity: "SAMPLE" based on scheme "http://www.fujitsu.com/xbrl/sample"

//Add values. Context context = instance.createContext(); context.setId("i1"); ContextEntity entity = instance.createContextEntity(); Identifier identifier = instance.createIdentifier(); identifier.setValue("SAMPLE"); identifier.setScheme("http://www.fujitsu.com/xbrl/sample"); entity.setIdentifier(identifier); context.setEntity(entity); Instant instant = instance.createInstant(); instant.setDate("2001-12-14"); context.setPeriod(instant); instance.addContext(context); Multiply unit = instance.createMultiply(); unit.setId("u1"); Measure measure = instance.createMeasure(); measure.setValue("http://www.xbrl.org/2003/iso4217", "JPY"); unit.addMeasure(measure); instance.addUnit(unit); nItem.setSpecifiedValue("100"); nItem.setContext(context); nItem.setUnit(unit); nItem.setPrecision("18");

Page 46: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 6 Tutorial

40

6.7 Saving XBRL Documents

Here, we save schemas, linkbase, and instance documents.

//Save taxonomies and instance documents. try { xbrlProc.saveXMLSchema(schema, null); xbrlProc.saveLinkbase(linkbase, null); xbrlProc.saveLinkbase(linkbase2, null); xbrlProc.saveInstance(instance, null); } catch (java.io.IOException e) { System.err.println("save error: " + e.getMessage()); } catch (org.xml.sax.SAXException e) { System.err.println("save error: " + e.getMessage()); } catch (XBRLProcessorException e) { System.err.println("save error: " + e.getMessage()); }

We serialize an XBRL data model in preparation for repeated processing of the same instance documents

and taxonomies.

//Serialize an XBRL document data model. try { FileOutputStream outputStream = new FileOutputStream("serialize.dat"); xbrlProc.serializeTaxonomySet(taxonomySet, outputStream); } catch (Exception e) { System.err.println("save error: " + e.getMessage()); }

For more information, see all relevant source programs and execution results shown in Appendix A,

"Tutorial Source Code" in this manual.

Page 47: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 7 Specifications and Restrictions

41

Chapter 7 Specifications and Restrictions

This chapter explains specifications and restrictions of the XBRL processor. For other related

specifications, see the "XBRL API Reference".

7.1 Handling of Elements by the XBRL Processor

When the XBRL processor handles XBRL documents, it may automatically supplement, modify, ignore or

abandon document information. This is described in greater detail in the subsequent sections. The following table shows the relationship between namespace prefixes and namespace URIs used in the

subsequent sections: Prefix Namespace URI xsd http://www.w3.org/2001/XMLSchema xsi http://www.w3.org/2001/XMLSchema-instance xbrli http://www.xbrl.org/2003/instance link http://www.xbrl.org/2003/linkbase

7.1.1 Elements relating to taxonomies and schemas

1) Elements relating to all taxonomies and schemas (Elements belonging to namespace http://www.w3.org/2001/XMLSchema)

Reading from a file

- User-defined attributes are ignored for elements other than the following elements: xsd:schema element xsd:element element right under the xsd:schema element

link:presentationArc, link:calculationArc, link:definitionArc, link:labelArc, and link:referenceArc elements

link:documentation element xsd:simpleType elememt, xsd:complexType element

- Elements listed below cannot be accessed from an XBRL data model. Information is retained and used for validation; however, a user cannot directly acquire and change that information.

These elements are output at schema output. xsd:any element

xsd:group element 2) xsd:schema element

Reading from a file

- Deletes any white spaces before and after the id attribute value.

- Deletes any white spaces before and after the targetNamespace attribute value. - Deletes any white spaces before and after the xml:base attribute value.

- Deletes any white spaces before and after the xml:lang attribute value. - Deletes any white spaces before and after the xsi:schemaLocation attribute value.

- Returns an error if the targetNamespace attribute of the schema to which another schema refers is not found.

- If the same targetNamespace attribute value is set for multiple schemas whose system identifiers are different, the second and subsequent schemas are integrated into the first-read

schema or the targetNamespace attributes of the second and subsequent schemas which were read are ignored.

Writing to a file

Page 48: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 7 Specifications and Restrictions

42

- Outputs sub-elements in the order of xsd:annotation element, xsd:import element, xsd:include element, xsd:element element, xsd:attribute element, xsd:simpleType element,

xsd:complexType element, xsd:group element, and other elements.

- Outputs the targetNamespace attribute value after URI encoding.

- Outputs the xml:base attribute value after URI encoding. - Outputs the xsi:schemaLocation attribute value after URI encoding.

3) xsd:element element

Reading from a file

- Deletes any white spaces before and after the abstract attribute value.

- Deletes any white spaces before and after the id attribute value. - Deletes any white spaces before and after the name attribute value.

- Deletes any white spaces before and after the nillable attribute value. - Deletes any white spaces before and after the ref attribute value.

- Deletes any white spaces before and after the substitutionGroup attribute value. - Deletes any white spaces before and after the type attribute value.

- Deletes any white spaces before and after the xbrli:balance attribute value. - Deletes any white spaces before and after the xbrli:periodType attribute value.

- Returns an error if the name attribute is not found. - Returns an error if the namespace does not exist in the type attribute value.

- Returns an error if the namespace does not exist in the substitutionGroup attribute value. Writing to a file

- Outputs the namespace declaration attribute values associated with the type attribute, substitutionGroup attribute and ref attribute values (QName) after URI encoding.

4) xsd:attribute element

Reading from a file

- Deletes any white spaces before and after the default attribute value.

- Deletes any white spaces before and after the fixed attribute value. - Deletes any white spaces before and after the form attribute value.

- Deletes any white spaces before and after the name attribute value. - Deletes any white spaces before and after the ref attribute value.

- Deletes any white spaces before and after the type attribute value. - Deletes any white spaces before and after the use attribute value.

- Ignores the xsd:annotation element. Writing to a file

- Outputs namespace declaration attribute values associated with the type attribute and ref attribute values (QName) after URI encoding.

5) xsd:anyAttribute element

Reading from a file

- Deletes any white spaces before and after the namespace attribute value.

- Deletes any white spaces before and after the processContents attribute value. - Ignores the xsd:annotation element.

6) xsd:simpleType element

Reading from a file

- Ignores the xsd:annotation element, xsd:list element, and xsd:union element.

Page 49: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 7 Specifications and Restrictions

43

7) xsd:simpleContent element

Reading from a file

- Ignores the xsd:annotation element. 8) xsd:complexContent element

Reading from a file

- Ignores the xsd:annotation element. 9) xsd:restriction element

Reading from a file

- Deletes any white spaces before and after the base attribute value.

- Ignores the xsd:annotation, and xsd:attributeGroup elements. Writing to a file

- Outputs the namespace declaration attribute values associated with the base attribute values (QName) after URI encoding.

- If the base attribute does not exist in the xsd:restriction element right under the xsd:complexContent element, the xsd:restriction element is not output and a model group is

output to the location right under the xsd:complexContent element. This operation can be changed by property setting (XBRLProperties.OUTPUT_VERBOSE_XML) for

XBRLProcessor. 10) xsd:annotation element

Reading from a file

- Ignores the elements having the link:linkbaseRef element as their sub-element and the elements existing right under the global element declaration.

Writing to a file

- Outputs the elements having the link:linkbaseRef element as their sub-element and the elements existing right under the global element declaration.

11) xsd:appinfo element

Reading from a file

- Ignores the elements other than those having the link:linkbaseRef element as their sub-element. Writing to a file

- Outputs only the elements having the link:linkbaseRef element as their sub-elements. 12) xsd:documentation element

Reading from a file

- Deletes any white spaces before and after the xml:lang attribute value.

- Ignores the elements other than those that belong to the xsd:element element as sub-elements.

13) link:roleType element Reading from a file

- Deletes any white spaces before and after the roleURI attribute value.

14) link:arcroleType element Reading from a file

- Deletes any white spaces before and after the arcroleURI attribute value. - Deletes any white spaces before and after the cyclesAllowed attribute value.

Page 50: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 7 Specifications and Restrictions

44

15) link:usedOn element

Reading from a file

- Deletes any white spaces before and after the link:usedOn element value. Writing to a file

- Outputs the namespace declaration attribute values associated with the link:usedOn element values (QName) after URI encoding.

16) xsd:import element Reading from a file

- Deletes any white spaces before and after the namespace attribute value. - Deletes any white spaces before and after the schemaLocation attribute value.

- Returns an error if the namespace attribute or schemaLocation is not found. - Ignores the xsd:import element if neither the namespace attribute nor schemaLocation is found.

- Returns an error if the namespace specified in the namespace attribute differs from the target namespace of the actual schema.

- Ignores the xsd:annotation element. Writing to a file

- Outputs the namespace attribute value after URI encoding. - Outputs the schemaLocation attribute value after URI encoding.

17) xsd:include element

Reading from a file

- Deletes any white spaces before and after the schemaLocation attribute value.

- Ignores the xsd:annotation element. - Fetches the specified schema and abandons the xsd:include element itself. This operation can

be changed by property setting (XBRLProperties. MERGE_INCLUDED_SCHEMA) for XBRLProcessor.

Writing to a file

- Does not output the xsd:include element. This operation can be changed by property setting (XBRLProperties. MERGE_INCLUDED_SCHEMA) for XBRLProcessor.

18) link:linkbaseRef element Explained later(7.1.4) in this document.

19) xsd:any element, xsd:group element

Reading from a file

- These information is read, but not reflected into XBRL data model.. Writing to a file

- The element is output. 20) Other elements

Reading from a file

- These information is read, but not reflected into XBRL data model. Writing to a file

- Not output. Only elements just under root node are output.

Page 51: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 7 Specifications and Restrictions

45

7.1.2 Elements relating to linkbases

1) All elements relating to linkbases (Elements belonging to the namespace http://www.xbrl.org/2003/linkbase)

Reading from a file

- Ignores the user-defined attributes excluding the following elements: link:presentationArc link:calculationArc

link:definitionArc link:labelArc

link:referenceArc link:documentation elements

2) link:linkbase element

Reading from a file

- Deletes any white spaces before and after the id attribute value.

- Deletes any white spaces before and after the xml:base attribute value. - Deletes any white spaces before and after the xml:lang attribute value.

- Deletes any white spaces before and after the xsi:schemaLocation attribute value. Writing to a file

- Outputs sub-elements in the order of link:documentation element, link:roleRef element, link:arcroleRef element, and extension link declaration element.

- Outputs the xml:base attribute value after URI encoding. - Outputs the xsi:schemaLocation attribute value after URI encoding.

3) link:presentationLink element, link:calculationLink element, link:definitionLink element,

link:labelLink element, and link:referenceLink element Reading from a file

- Deletes any white spaces before and after the id attribute value. - Deletes any white spaces before and after the xml:lang attribute value.

- Deletes any white spaces before and after the xlink:role attribute value. Writing to a file

- Outputs the xlink:role attribute value after URI encoding.

4) link:presentationArc element, link:calculationArc element, link:definitionArc element, link:labelArc element, and link:referenceArc element

Reading from a file

- Deletes any white spaces before and after the order attribute value. If the value is out of range of double, the value is rounded.

- Deletes any white spaces before and after the preferredLabel attribute value (PresentationArc).

- Deletes any white spaces before and after the priority attribute value. - Deletes any white spaces before and after the use attribute value.

- Deletes any white spaces before and after the weight attribute value (CalculationArc). - Deletes any white spaces before and after the xlink:arcrole attribute value. Writing to a file

- Outputs the arcrole attribute value after URI encoding. 5) link:label element

Page 52: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 7 Specifications and Restrictions

46

Reading from a file

- Deletes any white spaces before and after the id attribute value.

- Deletes any white spaces before and after the xlink:label attribute value. - Deletes any white spaces before and after the xlink:role attribute value.

- Deletes any white spaces before and after the xml:lang attribute value. Writing to a file

- Outputs the xlink:role attribute value after URI encoding.

6) link:reference element Reading from a file

- Deletes any white spaces before and after the id attribute value. - Deletes any white spaces before and after the xlink:label attribute value.

- Deletes any white spaces before and after the xlink:role attribute value. - Deletes any white spaces before and after the xml:lang attribute value. Writing to a file

- Outputs the xlink:role attribute value after URI encoding. 7) part element

None.

8) link:loc element Reading from a file

- Deletes any white spaces before and after the id attribute value. - Deletes any white spaces before and after the xlink:label attribute value.

- Deletes any white spaces before and after the xlink:role attribute value. - Abandons the information on the xlink:href attribute value after link analysis (does not retain

the information on Full XPointer and Child Sequence information). Writing to a file

- Uses bare name referencing for all xlink:href attribute values. - Outputs the xlink:href attribute value after URI encoding.

- Outputs the xlink:role attribute value after URI encoding. - For the xlink:href attribute value, outputs URI of the schema being referenced as a relative URI

whenever possible. This operation can be changed by property setting (XBRLProperties. OUTPUT_RELATIVE_PATH) for XBRLProcessor.

9) title element

Reading from a file

- Deletes any white spaces before and after the xml:lang attribute value. 10) link:documentation element

Reading from a file

- Deletes any white spaces before and after the xml:lang attribute value. 11) Other elements

Reading from a file

- Ignored. Writing to a file

- Not output.

Page 53: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 7 Specifications and Restrictions

47

7.1.3 Instance-related elements

1) All instance-related elements

(Elements belonging to the namespace http://www.xbrl.org/2001/instance) Reading from a file

- Ignores the user-defined attributes excluding the following elements: link:footnoteArc

link:documentation item and tuple

2) xbrli:xbrl element

Reading from a file

- Deletes any white spaces before and after the id attribute value.

- Deletes any white spaces before and after the xml:base attribute value. - Deletes any white spaces before and after the xml:lang attribute value.

- Deletes any white spaces before and after the xsi:schemaLocation attribute value. Writing to a file

- Outputs the xml:base attribute value after URI encoding. - Outputs the xsi:schemaLocation attribute value after URI encoding.

- Sub-elements are output in the order of link:schemaRef element, link:linkbaseRef element, link:roleRef element, link:arcroleRef element, xbrli:context element, xbrli:unit element, items

and tuples, and link:footnoteLink element .

3) Items and tuples Reading from a file

- Deletes any white spaces before and after the contextRef attribute value. - Deletes any white spaces before and after the decimals attribute value.

- Deletes any white spaces before and after the id attribute value. - Deletes any white spaces before and after the precision attribute value.

- Deletes any white spaces before and after the unitRef attribute value. - Deletes any white spaces before and after the xml:lang attribute value.

- Deletes any white spaces before and after the xsi:nil attribute value. - Makes corrections automatically if the numericContext or nonNumericContext attribute is used

for reference to context (posts an error to the error handler).

- Ignores items and tuples not defined in a schema. (Posts an error to the error handler.) 4) link:schemaRef element

Reading from a file

- Deletes any white spaces before and after the xlink:actuate attribute value.

- Deletes any white spaces before and after the xlink:href attribute value. - Deletes any white spaces before and after the xlink:role attribute value.

- Deletes any white spaces before and after the xlink:show attribute value. - Deletes any white spaces before and after the xlink:title attribute value.

- Deletes any white spaces before and after the xml:lang attribute value. Writing to a file

- Outputs the xlink:href attribute value after URI encoding. - Outputs the xlink:role attribute value after URI encoding.

Page 54: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 7 Specifications and Restrictions

48

- For the xlink:href attribute value, outputs the URI of the schema being referenced as a relative URI whenever possible. This operation can be changed by property setting (XBRLProperties.

OUTPUT_RELATIVE_PATH) for XBRLProcessor.

5) link:linkbaseRef element Explained later(7.1.4) in this document.

6) xbrli:context element

Reading from a file

- Deletes any white spaces before and after the id attribute value. Writing to a file

- Sub-elements are output in the order of xbrli:entity element, xbrli:period element, and xbrli:scenario element.

7) xbrli:entity element Writing to a file

- Sub-elements are output in the order of xbrli:identifier element and xbrli:segment element.

8) xbrli:identifier element Reading from a file

- Deletes any white spaces before and after the scheme attribute value. Writing to a file

- Outputs the scheme attribute value after URI encoding.

9) xbrli:segment element None.

10) xbrli:period element

None.

11) xbrli:period sub-elements None.

12) xbrli:unit element

Reading from a file

- Deletes any white spaces before and after the id attribute value. 13) xbrli:measure element

Writing to a file

- Outputs the namespace declaration attribute value associated with the xbrli:measure element value (QName) after URI encoding.

14) Other xbrli:unit sub-elements None

15) xbrli:scenario element

None.

Page 55: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 7 Specifications and Restrictions

49

16) link:footnoteLink element Reading from a file

- Deletes any white spaces before and after the id attribute value. - Deletes any white spaces before and after the xml:lang attribute value.

- Deletes any white spaces before and after the xlink:role attribute value. Writing to a file

- Adds link as the namespace prefix. - Outputs the xlink:role attribute value after URI encoding.

17) link:footnoteArc element

Reading from a file

- Deletes any white spaces before and after the order attribute value. If the value is out of range of double, the value is rounded.

- Deletes any white spaces before and after the priority attribute value.

- Deletes any white spaces before and after the use attribute value. - Deletes any white spaces before and after the xlink:arcrole attribute value. Writing to a file

- Adds link as the namespace prefix.

- Outputs the xlink:arcrole attribute value after URI encoding.

18) link:footnote element Reading from a file

- Deletes any white spaces before and after the id attribute value. - Deletes any white spaces before and after the xlink:label attribute value.

- Deletes any white spaces before and after the xlink:role attribute value. - Deletes any white spaces before and after the xml:lang attribute value. Writing to a file

- Adds link as the namespace prefix.

- Outputs the xlink:role attribute value after URI encoding.

19) link:loc element Reading from a file

- Deletes any white spaces before and after the id attribute value. - Deletes any white spaces before and after the xlink:label attribute value.

- Deletes any white spaces before and after the xlink:role attribute value. - Abandons the xlink:href attribute value information after link analysis (Full XPointer and Child

Sequence information is not retained.) Writing to a file

- Adds link as the namespace prefix. - Uses the bare name referencing for all xlink:href attributes.

- Outputs the xlink:href attribute value after URI encoding. - Outputs the xlink:role attribute value after URI encoding.

- For the xlink:href attribute value, outputs the URI of the instance being referenced as a relative URI whenever possible. This operation can be changed by property setting (XBRLProperties.

OUTPUT_RELATIVE_PATH) for XBRLProcessor.

20) Other elements Reading from a file

Page 56: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 7 Specifications and Restrictions

50

- Ignored. Writing to a file

- Not output.

7.1.4 Common elements

1) link:linkbaseRef element Reading from a file

- Deletes any white spaces before and after the xlink:actuate attribute value. - Deletes any white spaces before and after the xlink:arcrole attribute value.

- Deletes any white spaces before and after the xlink:href attribute value. - Deletes any white spaces before and after the xlink:role attribute value.

- Deletes any white spaces before and after the xlink:show attribute value. - Deletes any white spaces before and after the xlink:title attribute value.

- Deletes any white spaces before and after the xml:lang attribute value. - If the same linkbase is being referenced with multiple link:linkbaseRef elements (having the

same role attribute value), ignores the link:linkbaseRef elements other than the one first analyzed.

Writing to a file

- Outputs the link:linkbaseRef elements in the order of presentation link, calculation link, definition link, label link, and reference link.

- Outputs the xlink:href attribute value after URI encoding.

- Outputs the xlink:role attribute value after URI encoding. - For the xlink:href attribute value, outputs the URI of the schema being referenced as a relative

URI. This operation can be changed by property setting (XBRLProperties. OUTPUT_RELATIVE_PATH) for XBRLProcessor.

2) link:roleRef element

Reading from a file

- Abandons the xlink:href attribute value after link analysis (neither Full XPointer nor Child Sequence information is retained).

Writing to a file

- Outputs the xlink:href attribute value after URI encoding. - For the xlink:href attribute value, outputs the URI of the schema being referenced as a relative

URI. This operation can be changed by property setting (XBRLProperties. OUTPUT_RELATIVE_PATH) for XBRLProcessor.

3) link:arcroleRef element

Reading from a file

- Abandons the xlink:href attribute value information after link analysis (Full XPointer and Child Sequence information is not retained).

Writing to a file

- Outputs the xlink:href attribute value after URI encoding. - For the xlink:href attribute value, outputs the URL of the schema being referenced as a relative

URI whenever possible. This operation can be changed by property setting (XBRLProperties. OUTPUT_RELATIVE_PATH) for XBRLProcessor.

Page 57: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 7 Specifications and Restrictions

51

7.2 Other Specifications

A DOM constructed with parsers that do not recognize a namespace cannot be handled. The maximum number of objects that can be added with the add or insert method is the same as

the maximum number which ArrayList method allow.

Page 58: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 7 Specifications and Restrictions

52

7.3 Restrictions

Changing method like setter/add for XBRL data model is not thread-safe. The schemes supported as system identifiers are file, http, and ftp.

Only canonicalized system identifiers can be specified. Operation is not assured if a system identifier is specified that has not been canonicalized.

Example: Acceptable: http://www.foo.com/c

Unacceptable: http://www.foo.com/d/../c Any file having "#" in its path cannot be read properly.

For the following methods of an XBRL data model, the differences among the order attribute, weight attribute, preferredLabel attribute, and user-defined attributes of an arc are not considered

during overriding. In other words, even if arcs have different order attributes, for example, they are assumed to be identical and overriding is performed for them.

- RelationLink.getChildren(RelationLinkFilter filter, String role, String arcrole); - RelationLink.getParents(RelationLinkFilter filter, String role, String arcrole);

- RelationLink.getResolvedLinkInformation(RelationLink child, String role, String arcrole);

- RelationLink.getResolvedLinkInformationList(RelationLink child); - ResourceLink.getResources(Anchor anchor, ResourceLinkFilter filter,

String role, String arcrole);

- ResourceLink.getResolvedLinkInformation(Anchor anchor, Resource resource, String role, String arcrole);

- ResourceLink.getResolvedLinkInformationList(Anchor anchor, Resource resource); If, after an instance data model is created, the taxonomy data model that is the basis of that

creation is changed subsequently, instance data model operation is not assured.

If, after an instance data model is created, the a taxonomy data model that is the basis of that creation is changed subsequently, the operation of any instance data model newly created on the

basis of that taxonomy data model is not guaranteed. Operation is not assured if data models coexist that are constructed from different types of

TaxonomySet. Operation is not assured if data models coexist that are constructed from different types of

Instance. Even if the target namespace of a schema has been changed, any attribute value (QName) that is

referencing that namespace is not changed. In other words, a type reference may become invalid.

Even if a structure belonging to a tuple is defined with a schema, whether the instance structure is applicable to that structure definition is not checked. For this reason, a tuple having a

structure not applicable to the schema definition may be output.

7.4 Notes

If the application using the library of this product provides the services on the network like the Net, the application need

to take care about security. For example, this library loads the specified file even if the file is too big. If the application need to limit the file size to be loaded, the application need to manage the file size before the library loads the file.

Page 59: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 8 Changes in API Specifications

53

Chapter 8 Changes in API Specifications

8.1 Changes / Differences in API specifications from V1.2

This product supports XBRL 2.1 Errata and has made some changes for the purpose of convenience in the current version. As a result, the following changes in API specifications have been made.

Class Method Change Program

Compatibility Data

Compatibility Note

com.fujitsu.xml.xbrl.xwand.processor.XBRLProcessor loadInstance(Source insSource)

Previous Version: when abstract elements are contained in a content model, it resulted in an error and exception was thrown. Current Version: it does not result in an error.

Exception will not be thrown even when abstract elements are contained in a content model.

There is no influence on the existing valid data. Taxonomies having abstract elements in the content model is now treated as valid.

Errata support.

Previous Version: when any/group elements are contained in a content model, it resulted in an error and exception was thrown. Current Version: it does not result in an error.

Exception will not be thrown even when any/group elements are contained in a content model.

There is no influence on the existing valid data. Taxonomies having any/group elements in the content model is now treated as valid.

Errata support.

Previous Version: when role attribute of linkbaseRef is not defined in roleType, it resulted in an error and exception was thrown. Current Version: it does not result in an error.

Exception will not be thrown even when role attribute of linkbaseRef is not defined in roleType.

There is no influence on the existing valid data. Taxonomies having linkbaseRef elements with role attribute not defined in roleType.

Errata support.

The processor now does not skip reading schema having "http://www.xbrl.org/2003/ref" namespace. This schema is supposed to be accompanied by the taxonomy set in usual cases, and therefore the processor of the current version does not skip reading in the default setting.

If your program presupposes the skipping in the data model handling, you will need to let the program read the schema or change the program in the way that the skipping is explicitly done.

No influence. This is an improvement in view of actual usage in Consortium etc.

loadTaxonomySet(Source xsSource) loadTaxonomySet(Source xsSources[]) loadTaxonomySet(Source xsSources[], Source lbSources[]) Previous Version: when abstract elements are

contained in a content model, it resulted in an error and exception was thrown. Current Version: it does not result in an error.

Exception will not be thrown even when abstract elements are contained in a content model.

There is no influence on the existing valid data. Taxonomies having abstract elements in the content model is now treated as valid.

Errata support.

Previous Version: when any/group elements are contained in a content model, it resulted in an error and exception was thrown. Current Version: it does not result in an error.

Exception will not be thrown even when any/group elements are contained in a content model.

There is no influence on the existing valid data. Taxonomies having any/group elements in the content model is now treated as valid.

Errata support.

Previous Version: when role attribute of linkbaseRef is not defined in roleType, it resulted in an error and exception was thrown. Current Version: it does not result in an error.

Exception will not be thrown even when role attribute of linkbaseRef is not defined in roleType.

There is no influence on the existing valid data. Taxonomies having linkbaseRef elements with role attribute not defined in roleType.

Errata support.

saveInstance(Instance instance, Result result) The processor of the current version outputs all

attribute values specified when reading the document, even if they are default attribute values.

No influence. File output result with the current version is different from that with the previous version. Please note that there is NO influence on the compatibility as XML data. Moreover, the output wiht current version is more compatible with the input document than with the previous version.

This is an improvement for the purpose of achieving higher compatibility between input and output documents.

Page 60: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 8 Changes in API Specifications

54

The processor of the current version saves comments directly under the document root.

No influence. File output result with the current version is different from that with the previous version. Please note that there is NO influence on the compatibility as XML data. Moreover, the output wiht current version is more compatible with the input document than with the previous version.

This is an improvement for the purpose of achieving higher compatibility between input and output documents.

The processor of the current version outputs prefixes specified when reading the document as they are (i.e. outputs untouched).

No influence. File output result with the current version is different from that with the previous version. Please note that there is NO influence on the compatibility as XML data. Moreover, the output wiht current version is more compatible with the input document than with the previous version.

This is an improvement for the purpose of achieving higher compatibility between input and output documents.

saveTaxonomy(XMLSchema schema) saveXMLSchema(XMLSchema schema, Result result) Previous Version: when abstract elements are

contained in a content model, it resulted in an error and exception was thrown. Current Version: it does not result in an error.

Exception will not be thrown even when abstract elements are contained in a content model.

There is no influence on the existing valid data. Taxonomies having abstract elements in the content model is now treated as valid.

Errata support.

The processor of the current version outputs all attribute values specified when reading the document, even if they are default attribute values.

No influence. File output result with the current version is different from that with the previous version. Please note that there is NO influence on the compatibility as XML data. Moreover, the output wiht current version is more compatible with the input document than with the previous version.

This is an improvement for the purpose of achieving higher compatibility between input and output documents.

The processor of the current version saves and outputs user-defined attributes in type definition.

There is no influence. Note that if your application program has its own implementation of saving / outputting user-defined attributes of type definition, that processing will not be needed now.

File output result with the current version is different from that with the previous version. Please note that there is NO influence on the compatibility as XML data. Moreover, the output wiht current version is more compatible with the input document than with the previous version.

This is an improvement for the purpose of achieving higher compatibility between input and output documents.

The processor of the current version saves comments directly under the document root.

No influence. File output result with the current version is different from that with the previous version. Please note that there is NO influence on the compatibility as XML data. Moreover, the output wiht current version is more compatible with the input document than with the previous version.

This is an improvement for the purpose of achieving higher compatibility between input and output documents.

Page 61: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 8 Changes in API Specifications

55

The processor of the current version outputs prefixes specified when reading the document as they are (i.e. outputs untouched).

No influence. File output result with the current version is different from that with the previous version. Please note that there is NO influence on the compatibility as XML data. Moreover, the output wiht current version is more compatible with the input document than with the previous version.

This is an improvement for the purpose of achieving higher compatibility between input and output documents.

saveLinkbase(Linkbase linkbase, Result result) The processor of the current version outputs all

attribute values specified when reading the document, even if they are default attribute values.

No influence. File output result with the current version is different from that with the previous version. Please note that there is NO influence on the compatibility as XML data. Moreover, the output wiht current version is more compatible with the input document than with the previous version.

This is an improvement for the purpose of achieving higher compatibility between input and output documents.

The processor of the current version saves comments directly under the document root.

No influence. File output result with the current version is different from that with the previous version. Please note that there is NO influence on the compatibility as XML data. Moreover, the output wiht current version is more compatible with the input document than with the previous version.

This is an improvement for the purpose of achieving higher compatibility between input and output documents.

The processor of the current version outputs prefixes specified when reading the document as they are (i.e. outputs untouched).

No influence. File output result with the current version is different from that with the previous version. Please note that there is NO influence on the compatibility as XML data. Moreover, the output wiht current version is more compatible with the input document than with the previous version.

This is an improvement for the purpose of achieving higher compatibility between input and output documents.

importTaxonomySet(TaxonomySet taxonomySet, TaxonomySet iTaxonomySet) Previous Version: When different taxonomies

refer to a common taxonomy, the processor threw an exception. Current Version: Exception is not thrown and the reference is shared.

Exception is not thrown with the current version, even when different taxonomies refer to a common taxonomy.

No influence. This is an improvement for the purpose of making usability more convenient.

com.fujitsu.xml.xbrl.xwand.common.RelationLink getChildren(RelationLinkFilter filter, String role, String arcrole)

Changed to "deprecated". Changing to a substitute method is needed.

No influence. Errata support.

getParents(RelationLinkFilter filter, String role, String arcrole) Changed to "deprecated". Changing to a substitute

method is needed. No influence. Errata support.

getResolvedLinkInformation(RelationLink child, String role, String arcrole) Changed to "deprecated". Changing to a substitute

method is needed. No influence. Errata support.

getResolvedLinkInformationList(RelationLink child) Changed to "deprecated". Changing to a substitute

method is needed. No influence. Errata support.

com.fujitsu.xml.xbrl.xwand.common.ResourceLink getResources(Anchor anchor, ResourceLinkFilter filter, String role, String arcrole)

Changed to "deprecated". Changing to a substitute method is needed.

No influence. Errata support.

getResolvedLinkInformation(Anchor anchor, Resource resource, String role, String arcrole)

Page 62: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 8 Changes in API Specifications

56

Changed to "deprecated". Changing to a substitute method is needed.

No influence. Errata support.

getResolvedLinkInformationList(Anchor anchor, Resource resource) Changed to "deprecated". Changing to a substitute

method is needed. No influence. Errata support.

com.fujitsu.xml.xbrl.xwand.taxonomy.ElementDecl setSubstitutionGroup(String namespaceURI, String localName)

Previous Version: When trying to change an element with abstract = "true" to a tuple, an exception was thrown as an error. Current Version: it does not result in an error.

There is no need to change your program, simply because it is made possible in the current version to change an element with abstract="true" to a tuple.

No influence. Errata support.

setAbstract(boolean abst) Previous Version: When trying to set "true" value

to abstract attribute, an exception was thrown as an error. Current Version: it does not result in an error.

There is no need to change your program, because it is made possible in the current version to set abstract="true".

No influence. Errata support.

setContentType(ContentType contentType) setSimpleType(SimpleType simpleType) The processor of the current version throws an

error when schemas of the following two are different: 1 Schema having element declarations 2 Schema having type definitions (anonymous) or attribute declarations (local)

If your application allows these two schemas to be different (which is a breach of XBRL specification), it will raise errors. You need to change the program so that it does not allow such situations.

No influence. This is an improvement to achieve robuster validation.

com.fujitsu.xml.xbrl.xwand.taxonomy.XMLSchema All

The processor of the current version does not allow users to edit imported xbrl-instance.xsd model.

If your program has a process of editing the data model of xbrl-instance.xsd, it will raise errors. The xbrl-instance.xsd is a schema predefined by specification, and thus editing is not allowed. So, if such errors occur, it is a revelation of a potential problem.

No influence. This is an improvement to achieve robuster validation.

com.fujitsu.xml.xbrl.xwand.taxonomy.contentmodel.ContentType addAttrDecl(AttrDecl attrDecl)

insertAttrDecl(AttrDecl attrDecl, AttrDecl ref) The processor of the current version throws an

error when schemas of the following two are different: 1 Schema having element declarations 2 Schema having type definitions (anonymous) or attribute declarations (local)

If your application allows these two schemas to be different (which is a breach of XBRL specification), it will raise errors. You need to change the program so that it does not allow such situations.

There is no influence on existing valid data.

This is an improvement to achieve robuster validation.

The processor of the current version throws an error when the attribute value of "name" in attribute declaration is already used elsewhere.

It is wrong to specify an already used value as "name" attribute value. Throwing an error is reasonable and wrong programs should be fixed to avoid such a collision of plural names.

There is no influence on existing valid data.

This is an improvement to achieve robuster validation.

com.fujitsu.xml.xbrl.xwand.instance.UserElement getUserAttrs()

In the processor of the current version, the following namespaces cannot be used in tuple. "http://www.xbrl.org/2003/linkbase" "http://www.xbrl.org/2003/XLink" "http://www.w3.org/1999/xlink"

If your program contains these namespaces, it will throw exceptions. It should be modified not to set them.

Data containing these namespaces will be reported as errors.

Errata support.

setNil(boolean nil)

Page 63: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 8 Changes in API Specifications

57

Previous Version: Error was NOT issued when setting nil attribute value in an item which precision/decimals attribute value is set. Current Version: It now results in an error in such a case.

It is a breach of XBRL Specification to do this. It is reasonable to throw an exception in such occations. If your program is doing such setting, it should be fixed not to do this.

There is no influence on existing valid data.

This is an improvement to achieve robuster validation.

com.fujitsu.xml.xbrl.xwand.instance.NumericValue SetPrecision(String precision)

The processor of the current version throws an exception when trying to set an attribute value to an item with nil="true".

It is a breach of XBRL Specification to do this. It is reasonable to throw an exception in such occations. If your program is doing such setting, it should be fixed not to do this.

There is no influence on existing valid data.

This is an improvement to achieve robuster validation.

Page 64: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 8 Changes in API Specifications

58

8.2 Changes / Differences in API specifications from V7.0

This product supports XBRL 2.1 Errata and has made some changes for the purpose of convenience in the current version. As a result, the following changes in API specifications have been made.

Class Method Change Program

Compatibility Data

Compatibility Note

com.fujitsu.xml.xbrl.xwand.processor.XBRLEntityResolver resolveInputEntity(String namespace, String sysId)

The namespace argument may become non-null according to the situation when this method is called to xsd:include element.

If your program presupposes the namespace is null, you will need to change the program.

No influence. This is an improvement for convenience.

com.fujitsu.xml.xbrl.xwand.processor.XBRLProcessor All

The processor makes XMLSchema data model of xbrl-instance.xsd.

No influence. No influence. This is an improvement for convenience.

com.fujitsu.xml.xbrl.xwand.processor.XBRLProcessorException WARNING_DERIVING_TYPES_BY_RESTRICTION_NOT_SUPPORTED

WARNING_DERIVING_TYPES_FROM_SIMPLE_TYPE_NOT_SUPPORTED WARNING_UNEXPECTED_XML_SCHEMA_ELEMENT WARNING_LOCAL_ELEMENT_DECL_NOT_SUPPORTED WARNING_ANY_ELEMENT_NOT_SUPPORTED WARNING_GROUP_ELEMENT_NOT_SUPPORTED Changed to "deprecated". No influence. No influence. This is for data

model enhancement.

ERROR_XBRL_INSTANCE_SCHEMA_NOT_IMPORTED

Changed to "deprecated". No influence. No influence. Integrated into other error code.

ERROR_SRC_AND_DEST_LOCATOR_HAVE_SAME_LABEL ERROR_INVALID_UNIT_FOR_PURE_ITEM Changed to "deprecated". No influence. No influence. Errata support. WARNING_SAME_LINKBASE_REFERRED ERROR_NAMESPACE_OF_IMPORT_NOT_SPECIFIED ERROR_LOOP_OF_XML_SCHEMAS_DETECTED Changed to "deprecated". No influence. No influence. This is an

improvement for convenience.

com.fujitsu.xml.xbrl.xwand.common.Arc

getUserAttrs()

Changed "preferredLabel" to prohibition attribute of setting.

If your program uses this method to set "preferredLabel" instead of PresentationArc.setPreferredLabel (String prefLabel), you will need to change the program.

No influence. This is an improvement for API consistency and convenience.

com.fujitsu.xml.xbrl.xwand.common.XBRLDataException

ERROR_ELEMENT_DECL_ALREADY_REGISTERED_TO_ANOTHER_XML_SCHEMA Changed to "deprecated". No influence. No influence. Integrated into other

error code. ERROR_SAME_LOCATOR_SPECIFIED ERROR_LOOP_OF_XML_SCHEMAS_DETECTED Changed to "deprecated". No influence. No influence. This is an

improvement for convenience.

com.fujitsu.xml.xbrl.xwand.common.XBRLDocument

putNamespacePrefix(String namespaceURI, String prefix) Changed the default prefix "xbrll" of

http://www.xbrl.org/2003/linkbase to "link". If your program presupposes the corresponding prefix value is "xbrll", you will need to change the program.

No influence. This is an improvement in view of actual usage in Consortium etc.

Deleted the following namespaces from the default association of namespace URI and its prefix: "http://www.xbrl.org/2001/instance" "http://www.xbrl.org/2001/XLink/xbrllinkbase"

If your program presupposes the corresponding associations are pre-defined, you will need to change the program.

No influence. This is an improvement in view of actual usage in Consortium etc.

com.fujitsu.xml.xbrl.xwand.taxonomy.ElementDecl getUserAttrs()

Page 65: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 8 Changes in API Specifications

59

Changed "ref" to prohibition attribute of setting. If your program uses this method to set "ref" instead of ElementRef class, you will need to change the program.

No influence. This is an improvement for API consistency and convenience.

getDocumentations() addDocumentation(XSDocumentation documentation) insertDocumentation(XSDocumentation documentation, XSDocumentation ref) removeDocumentation(XSDocumentation documentation) Changed to not "deprecated". No influence. No influence. This is for data

model enhancement.

com.fujitsu.xml.xbrl.xwand.taxonomy.XMLSchema

setTargetNamespace(String namespsace)

The processor of the current version requires the target namespace only if the XML schema is referred from the other XML schema.

No influence. No influence. This is an improvement for convenience.

addBaseSchema(XMLSchema schema) insertBaseSchema(XMLSchema schema, XMLSchema ref) Changed to allow the loop of the XML schema

reference. No influence. No influence. This is an

improvement for convenience.

com.fujitsu.xml.xbrl.xwand.taxonomy.XSDocumentation com.fujitsu.xml.xbrl.xwand.taxonomy.XSDocumentationList

All Changed to not "deprecated". No influence. No influence. This is for element

declaration enhancement.

com.fujitsu.xml.xbrl.xwand.taxonomy.role.ArcroleType

getDefinitions() addDefinition(Definition definition) insertDefinition(Definition definition, Definition ref) removeDefinition(Definition definition)

Changed to "deprecated". No influence. No influence. This is an improvement for convenience.

addUsedOn(UsedOn usedOn) insertUsedOn(UsedOn usedOn, UsedOn ref) The processor of the current version throws an

error when the usedOn element overlaps. If your application allows the usedOn element overlaps(which is a breach of XBRL specification), it will raise errors. You need to change the program so that it does not allow such situations.

Data containing these usedOn elements will be reported as errors.

Errata support.

com.fujitsu.xml.xbrl.xwand.taxonomy.role.RoleType

getDefinitions() addDefinition(Definition definition) insertDefinition(Definition definition, Definition ref) removeDefinition(Definition definition) Changed to "deprecated". No influence. No influence. This is an

improvement for convenience.

addUsedOn(UsedOn usedOn) insertUsedOn(UsedOn usedOn, UsedOn ref) The processor of the current version throws an

error when the usedOn element overlaps. If your application allows the usedOn element overlaps(which is a breach of XBRL specification), it will raise errors. You need to change the program so that it does not allow such situations.

Data containing these usedOn elements will be reported as errors.

Errata support.

com.fujitsu.xml.xbrl.xwand.instance.NumericItem calculate()

calculate(String role) calculate(int roundingMode) calculate(String role, int roundingMode) The processor of the current version sets the

calculated value when the nil attribute value of the item is "true".

No influence. There is no influence on the existing valid data. For the existing non-valid data, the report on the error might change.

This is an improvement to achieve robuster validation.

Page 66: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 8 Changes in API Specifications

60

Previous Version: When calculation, the calculation value was given priority. Current Version: When calculation in default, only the value in instance is used. By using CalculationOption class, the above can be changed.

No influence. There is no influence on the existing valid data. For the existing non-valid data, the report on the error might change.

Errata support.

Previous Version: When calculation, an incomplete calculation was ignored. Current Version: When calculation in default, an incomplete calculation is not ignored. By using CalculationOption class, the above can be changed.

No influence. There is no influence on the existing valid data. For the existing non-valid data, the report on the error might change.

Errata support.

Page 67: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 8 Changes in API Specifications

61

8.3 Changes / Differences in API specifications from V7.1

This product supports the latest XML Schema specification. As a result, the following changes in API specifications have been made.

Class Method Change Program

Compatibility Data

Compatibility Note

com.fujitsu.xml.xbrl.xwand.processor.XBRLProcessor loadInstance(Source insSource)

loadInstance(TaxonomySet taxonomySet, Source insSource) Compatible XML Schema specification

changed. If your application loads an instance which includes the value of gMonth data type not compatible to "XML Schema Part 2: Datatypes Second Edition", validation error occurs for the value of gMonth data type. As a result, the value is not reflected into the datamodel.

If your application loads an instance which includes the value of gMonth data type not compatible to "XML Schema Part 2: Datatypes Second Edition", validation error occurs.

com.fujitsu.xml.xbrl.xwand.instance.Item setSpecifiedValue(String specified)

Compatible XML Schema specification changed.

If your application calls this method with the value of gMonth data type not compatible to "XML Schema Part 2: Datatypes Second Edition", it will raise errors.

If your application calls this method with the value of gMonth data type not compatible to "XML Schema Part 2: Datatypes Second Edition", it will raise errors.

Page 68: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 8 Changes in API Specifications

62

8.4 Changes / Differences in API specifications from V9.0

Data validation has been enhanced to match the operating conditions of consortiums and similar. As a result, the following changes in API specifications have been made.

Class Method Change Program

Compatibility Data

Compatibility Note

com.fujitsu.xml.xbrl.xwand.processor.XBRLProcessor

The read process in general

The default value of calling the EntityResolver of DocumentBuilder/Transformer changed to posting a call to the XBRLEntityResolver of XBRLProcessor.

During XML processing prior to XBRL processing, instead of issuing a call to the EntityResolver, now a call is posted to XBRLEntityResolver.

No influence. This is an improvement for convenience.

The rules for prefix change processing when a namespace declaration is duplicated changed to the same as for the taxonomy editor. That is, the format has changed from p_1, p_2, etc. to p0,p1.

No influence. The file output results when a namespace prefix is duplicated in a document have changed, but the compatibility as XML data is not affected.

This is an improvement to match tool specifications.

The following changes in context element comparisons: s-equal processing: - ID attribute removed from comparison targets - Elements and attributes compared after trimming x-equal processing: - Element contents compared after trimming

No influence. Depending on the entries under a context element, check results based on calculation links may have changes.

This change is based on discussions with the specifications determining body.

Changed to report an error when the XML contents set for segment/scenario/footnote/label do not match XBRL specifications.

No influence. There is no effect on existing normal data, but a new error is reported for abnormal data.

This is an improvement to achieve more robust validation.

Changed to report an error when the user definition attributes do not match XBRL specifications.

No influence. There is no effect on existing normal data, but a new error is reported for abnormal data.

This is an improvement to achieve more robust validation.

Changed to report an error when the roleURI attribute value of a roleType element or the arcroleURI attribute value of an arcroleType element do not match XBRL specifications (relative URI format).

No influence. There is no effect on existing normal data, but a new error is reported for abnormal data.

This is an improvement to achieve more robust validation.

Changed to report a warning when the following data is completed or changed during data model creation: - schemaLocation attribute completed - Definition completed for import to XML schema - Replacement of duplicated prefix

No influence. There is no effect on existing normal data, but a new warning is reported for abnormal data.

This is an improvement to achieve more robust validation.

Changed to not complete a default namespace declaration that is not in the original document.

No influence. No influence. This is an improvement for convenience.

The save process in general Changed to correct the error and report a

warning when there is an incorrect location entry in an XBRL normative schema coded as the schemaLocation attribute value.

No influence. There is no effect on existing normal data, but a new warning is reported for abnormal data.

This is an improvement for convenience.

Changed to complete the namespace declaration and report a warning when saving data that uses a namespace URI that has no namespace declaration if the namespace is declared somewhere other than in the DTS.

No influence. There is no effect on existing normal data, but previously a fatal error was issued for abnormal data. Now a warning is reported and a fatal error does not occur.

This is an improvement for convenience.

Changed to not delete unused standard namespace declarations from namespace declarations registered using XBRLDocument.putNamespacePrefix().

No influence. No influence. This is an improvement for convenience.

com.fujitsu.xml.xbrl.xwand.processor.XBRLProcessorException

WARNING_SIMPLE_TYPE_IN_RESTRICTION_NOT_SUPPORTED ERROR_BASE_OF_CONTENT_TYPE_NOT_SPECIFIED ERROR_BASE_OF_SIMPLE_TYPE_NOT_SPECIFIED Changed to deprecated. No influence. No influence. This change results

from data model

Page 69: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Chapter 8 Changes in API Specifications

63

function enhancements.

getMessage() issued for MESSAGE type

Path name included in the return value message changed from an absolute path to the relative path when a file read by an application is specified by a relative path.

No influence. No influence. This is an improvement for convenience.

com.fujitsu.xml.xbrl.xwand.instance.Segment com.fujitsu.xml.xbrl.xwand.instance.Scenario com.fujitsu.xml.xbrl.xwand.instance.Footnote com.fujitsu.xml.xbrl.xwand.taxonomy.Label Method that sets DOM node as a value

Changed to report an error when the set XML contents do not match XBRL specifications.

Programs that have settings prohibited under XBRL throw exceptions and therefore must be corrected.

No influence. This is an improvement to achieve robuster validation.

com.fujitsu.xml.xbrl.xwand.taxonomy.ElementDecl com.fujitsu.xml.xbrl.xwand.taxonomy.contentmodel.DerivedType com.fujitsu.xml.xbrl.xwand.taxonomy.contentmodel.AttrDecl Method that sets type

Changed to report an error when the reference relation of the type definition does not match the reference relation of the XML schema.

Programs that have incorrect type settings that do not match the reference relation of the XML schema throw exceptions and therefore must be corrected.

No influence. This is an improvement to achieve robuster validation.

com.fujitsu.xml.xbrl.xwand.taxonomy.ElementDecl

setContentType(ContentType contentType) setSimpleType(SimpleType simpleType) setType(String namespaceURI, String localName)

Changed to report an error in the following cases: - Setting a type other than the item type in an item contents model - Setting a type other than the item type in an anonymous type definition - Setting a local attribute other than an id attribute in an item or a tuple

Programs that have settings prohibited under XBRL throw exceptions and therefore must be corrected.

No influence. This is an improvement to achieve robuster validation.

com.fujitsu.xml.xbrl.xwand.common.UserAttrList

setAttribute(String namespaceURI, String localName, String value) setValue(int index, String value)

Changed to report an error when the user definition attribute does not match XBRL specifications.

Programs that have settings prohibited under XBRL throw exceptions and therefore must be corrected.

No influence. This is an improvement to achieve robuster validation.

com.fujitsu.xml.xbrl.xwand.taxonomy.role.ArcroleType com.fujitsu.xml.xbrl.xwand.taxonomy.role.RoleType Arcrole attribute value and role attribute value settings

Changed to report an error when the arcroleURI/roleURI attribute value does not match XBRL specifications (relative URI format).

Programs that have settings prohibited under XBRL throw exceptions and therefore must be corrected.

No influence. This is an improvement to achieve robuster validation.

Page 70: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Appendix A Tutorial Source Code

64

Appendix A Tutorial Source Code

--- XBRLSample.java ---

import java.io.FileOutputStream; import com.fujitsu.xml.xbrl.xwand.common.Link; import com.fujitsu.xml.xbrl.xwand.common.LinkInformation; import com.fujitsu.xml.xbrl.xwand.common.Locator; import com.fujitsu.xml.xbrl.xwand.common.XLinkDecl; import com.fujitsu.xml.xbrl.xwand.instance.Context; import com.fujitsu.xml.xbrl.xwand.instance.ContextEntity; import com.fujitsu.xml.xbrl.xwand.instance.Identifier; import com.fujitsu.xml.xbrl.xwand.instance.Instance; import com.fujitsu.xml.xbrl.xwand.instance.Instant; import com.fujitsu.xml.xbrl.xwand.instance.Measure; import com.fujitsu.xml.xbrl.xwand.instance.Multiply; import com.fujitsu.xml.xbrl.xwand.instance.NumericItem; import com.fujitsu.xml.xbrl.xwand.processor.XBRLProcessor; import com.fujitsu.xml.xbrl.xwand.processor.XBRLProcessorException; import com.fujitsu.xml.xbrl.xwand.taxonomy.ElementDecl; import com.fujitsu.xml.xbrl.xwand.taxonomy.Label; import com.fujitsu.xml.xbrl.xwand.taxonomy.LabelArc; import com.fujitsu.xml.xbrl.xwand.taxonomy.LabelLink; import com.fujitsu.xml.xbrl.xwand.taxonomy.LabelLocator; import com.fujitsu.xml.xbrl.xwand.taxonomy.Linkbase; import com.fujitsu.xml.xbrl.xwand.taxonomy.PresentationArc; import com.fujitsu.xml.xbrl.xwand.taxonomy.PresentationLink; import com.fujitsu.xml.xbrl.xwand.taxonomy.TaxonomySet; import com.fujitsu.xml.xbrl.xwand.taxonomy.XMLSchema; class XBRLSample { public static void main(String args[]) { String xsSysId = "sampleTaxonomy.xsd"; String insSysId = "sampleInstance.xml"; XBRLProcessor xbrlProc = new XBRLProcessor(); //Create new TaxonomySet. TaxonomySet taxonomySet = xbrlProc.newTaxonomySet(); //Create and specify schemas. XMLSchema schema = taxonomySet.createXMLSchema(); schema.setSystemId(xsSysId); schema.setTargetNamespace("http://www.fujitsu.com/xbrl/sample"); schema.putNamespacePrefix("http://www.fujitsu.com/xbrl/sample", "fj"); schema.getUserAttrs().setAttribute("", "elementFormDefault", "qualified"); taxonomySet.addPrimarySchema(schema); //Import xbrl-instance.xsd. try { schema.addBaseSchema(xbrlProc. getXBRLInstanceSchema(taxonomySet)); } catch (Exception e) { } //Add "element" elements ElementDecl element = schema.createElementDecl(); element.setId("sample_id"); element.setName("sample_name"); element.setPeriodType(ElementDecl.PERIOD_TYPE_INSTANT); element.setType(ElementDecl.XBRL_INSTANCE_NS_URI, ElementDecl.TYPE_MONETARY_ITEM);

Page 71: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Appendix A Tutorial Source Code

65

element.setSubstitutionGroup(ElementDecl.XBRL_INSTANCE_NS_URI, ElementDecl.SUB_GROUP_ITEM); schema.addElementDecl(element); ElementDecl element2 = schema.createElementDecl(); element2.setId("sample_id2"); element2.setName("sample_name2"); element2.setPeriodType(ElementDecl.PERIOD_TYPE_INSTANT); element2.setType(ElementDecl.XBRL_INSTANCE_NS_URI, ElementDecl.TYPE_MONETARY_ITEM); element2.setSubstitutionGroup(ElementDecl.XBRL_INSTANCE_NS_URI, ElementDecl.SUB_GROUP_ITEM); schema.addElementDecl(element2); //Add a link. //Register the representation link reference. Linkbase linkbase = taxonomySet.createLinkbase(); linkbase.setSystemId("link_presentaion.xml"); schema.addLinkbase(Link.LINK_TYPE_PRESENTATION, linkbase); //Create a link. PresentationLink pLink = taxonomySet.createPresentationLink(); //Specify an element in a link node. pLink.setElementDecl(element); //Register the link as the root. taxonomySet.addRootPresentationLink(pLink); //Create a link containing an element for which a link is to be registered. PresentationLink childLink = taxonomySet.createPresentationLink(); childLink.setElementDecl(element2); pLink.addChild(childLink); XLinkDecl xDecl = linkbase.createXLinkDecl(); linkbase.addXLinkDecl(xDecl); PresentationArc arc = xDecl.createPresentationArc(); arc.setArcrole(PresentationArc.ARCROLE_PARENT_CHILD); arc.setOrder(10); Locator srcLoc = xDecl.createPresentationLocator(); srcLoc.setLabel("src"); Locator destLoc = xDecl.createPresentationLocator(); destLoc.setLabel("dest"); LinkInformation linkInformation = xDecl.createLinkInformation(srcLoc, destLoc, arc); xDecl.addLinkInformation(linkInformation); pLink.addLinkInformation(childLink, linkInformation); //Register a label link reference. Linkbase linkbase2 = taxonomySet.createLinkbase(); linkbase2.setSystemId("link_label.xml"); schema.addLinkbase(Link.LINK_TYPE_LABEL, linkbase2); LabelLink lLink = taxonomySet.getLabelLink(); //Create a label resource. Label label = taxonomySet.createLabel(); label.setLanguage("ja"); label.setLabelElementsAsString("TEST"); //Register a link destination resource in the link. lLink.addLabel(element, label); //Create link information. XLinkDecl xDecl2 = linkbase2.createXLinkDecl(); linkbase2.addXLinkDecl(xDecl2);

Page 72: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Appendix A Tutorial Source Code

66

LabelArc arc2 = xDecl2.createLabelArc(); arc2.setArcrole(LabelArc.ARCROLE_CONCEPT_LABEL); Locator srcLoc2 = xDecl2.createLabelLocator(); srcLoc2.setLabel("element"); Locator destLoc2 = xDecl2.createLabelLocator(); destLoc2.setLabel("label"); destLoc2.setRole(LabelLocator.ROLE_LABEL); LinkInformation linkInformation2 = xDecl2.createLinkInformation(srcLoc2, destLoc2, arc2); xDecl2.addLinkInformation(linkInformation2); //Register link information. lLink.addLinkInformation(element, label, linkInformation2); //Create and specify instance information Instance instance = null; try { instance = xbrlProc.newInstance(taxonomySet); } catch (XBRLProcessorException e) { System.err.println("creation error: " + e.getMessage()); } instance.setSystemId(insSysId); //Register a prefix. instance.putNamespacePrefix("http://www.fujitsu.com/xbrl/sample", "fj"); instance.putNamespacePrefix("http://www.xbrl.org/2003/iso4217", "ISO4217"); // Add contexts Context context = instance.createContext(); context.setId("i1"); ContextEntity entity = instance.createContextEntity(); Identifier identifier = instance.createIdentifier("SAMPLE", "http://www.fujitsu.com/xbrl/sample"); entity.setIdentifier(identifier); context.setEntity(entity); Instant instant = instance.createInstant("2001-12-14"); context.setPeriod(instant); instance.addContext(context); // Add units Multiply unit = instance.createMultiply(); unit.setId("u1"); Measure measure = instance.createMeasure("http://www.xbrl.org/2003/iso4217", "JPY"); unit.addMeasure(measure); instance.addUnit(unit); //Add items. NumericItem nItem = instance.createNumericItem(element, context, unit, "100"); nItem.setPrecision("18"); instance.addChild(nItem); //Save taxonomies and instance documents. try { xbrlProc.saveXMLSchema(schema, null); xbrlProc.saveLinkbase(linkbase, null); xbrlProc.saveLinkbase(linkbase2, null); xbrlProc.saveInstance(instance, null); } catch (java.io.IOException e) { System.err.println("save error: " + e.getMessage()); } catch (org.xml.sax.SAXException e) { System.err.println("save error: " + e.getMessage()); }

Page 73: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Appendix A Tutorial Source Code

67

catch (XBRLProcessorException e) { System.err.println("save error: " + e.getMessage()); } //Serialize the XBRL document data model. try { FileOutputStream outputStream = new FileOutputStream("serialize.dat"); xbrlProc.serializeTaxonomySet(taxonomySet, outputStream); } catch (Exception e) { System.err.println("save error: " + e.getMessage()); } } }

Page 74: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Appendix A Tutorial Source Code

68

Execution results --- Taxonomy: sampleTaxonomy.xsd ---

<?xml version="1.0" ?> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fj=http://www.fujitsu.com/xbrl/sample elementFormDefault="qualified" targetNamespace="http://www.fujitsu.com/xbrl/sample"> <annotation> <appinfo> <link:linkbaseRef xlink:type="simple" xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase" xlink:href="link_presentaion.xml" xlink:role="http://www.xbrl.org/2003/role/presentationLinkbaseRef"/> <link:linkbaseRef xlink:type="simple" xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase" xlink:href="link_label.xml" xlink:role="http://www.xbrl.org/2003/role/labelLinkbaseRef" /> </appinfo> </annotation> <import namespace="http://www.xbrl.org/2003/instance" schemaLocation="http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd" /> <element name="sample_name" id="sample_id" type="xbrli:monetaryItemType" substitutionGroup="xbrli:item" xbrli:periodType="instant" /> <element name="sample_name2" id="sample_id2" type="xbrli:monetaryItemType" substitutionGroup="xbrli:item" xbrli:periodType="instant" /> </schema>

--- Linkbase document: link_presentaion.xml ---

<?xml version="1.0" ?> <linkbase xmlns="http://www.xbrl.org/2003/linkbase" xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <presentationLink xlink:type="extended" xlink:role="http://www.xbrl.org/2003/role/link"> <loc xlink:type="locator" xlink:href="sampleTaxonomy.xsd#sample_id" xlink:label="src" /> <loc xlink:type="locator" xlink:href="sampleTaxonomy.xsd#sample_id2" xlink:label="dest" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="src" xlink:to="dest" order="10.0" /> </presentationLink> </linkbase>

--- Linkbase document: link_label.xml ---

<?xml version="1.0" ?> <linkbase xmlns="http://www.xbrl.org/2003/linkbase" xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <labelLink xlink:type="extended" xlink:role="http://www.xbrl.org/2003/role/link"> <loc xlink:type="locator" xlink:href="sampleTaxonomy.xsd#sample_id" xlink:label="element" /> <label xlink:type="resource" xlink:label="label" xml:lang="ja">Test</label> <labelArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/concept-label" xlink:from="element" xlink:to="label" />

Page 75: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Appendix A Tutorial Source Code

69

</labelLink> </linkbase>

--- Instance document: sampleInstance.xml ---

<?xml version="1.0" ?> <xbrl xmlns="http://www.xbrl.org/2003/instance" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fj="http://www.fujitsu.com/xbrl/sample" xmlns:ISO4217="http://www.xbrl.org/2003/iso4217" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <link:schemaRef xlink:type="simple" xlink:href="sampleTaxonomy.xsd" /> <context id="i1"> <entity> <identifier scheme="http://www.fujitsu.com/xbrl/sample">SAMPLE</identifier> </entity> <period> <instant>2001-12-14</instant> </period> </context> <unit id="u1"> <measure>ISO4217:JPY</measure> </unit> <fj:sample_name precision="18" contextRef="i1" unitRef="u1">100</fj:sample_name> </xbrl>

--- Serialization file: serialize.dat --- (This file is not provided here because it is a binary file.)

Page 76: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Appendix A Tutorial Source Code

70

Appendix B Samples of Overridden Documents

--- Taxonomy: sample_base.xsd ---

<?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fjb="http://www.fujitsu.com/demo/2002-11-11" elementFormDefault="qualified" targetNamespace="http://www.fujitsu.com/demo/2002-11-11"> <annotation> <appinfo> <link:linkbaseRef xlink:type="simple" xlink:actuate="onRequest" xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase" xlink:href="link_base.xml" xlink:role="http://www.xbrl.org/2003/role/presentationLinkbaseRef"> </appinfo> </annotation> <import namespace=http://www.xbrl.org/2003/instance schemaLocation="http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd"/> <element id="testroot" name="testroot" type="xbrli:monetaryItemType" substitutionGroup="xbrli:item" xbrli:periodType="instant"/> <element id="test1" name="test1" type="xbrli:monetaryItemType" substitutionGroup="xbrli:item" xbrli:periodType="instant"/> <element id="test2" name="test2" type="xbrli:monetaryItemType" substitutionGroup="xbrli:item" xbrli:periodType="instant"/> </schema>

--- Taxonomy: sample_over.xsd ---

<?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fjo="http://www.fujitsu.com/demo/2002-11-12" elementFormDefault="qualified" targetNamespace="http://www.fujitsu.com/demo/2002-11-12"> <annotation> <appinfo> <link:linkbaseRef xlink:type="simple" xlink:actuate="onRequest" xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase" xlink:href="link_over.xml" xlink:role="http://www.xbrl.org/2003/role/presentationLinkbaseRef"> </appinfo> </annotation> <import namespace="http://www.fujitsu.com/demo/2002-11-11" schemaLocation="sample_base.xsd"/> </schema>

--- Link document: link_base.xml ---

<?xml version="1.0" encoding="UTF-8"?> <linkbase xmlns="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink"> <presentationLink xlink:type="extended" xlink:role="http://www.xbrl.org/2003/role/link">

Page 77: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Appendix B Samples of Overridden Documents

71

<loc xlink:type="locator" xlink:href="sample_base.xsd#testroot" xlink:label="src"/> <loc xlink:type="locator" xlink:href="sample_base.xsd#test1" xlink:label="dest"/> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="src" xlink:to="dest" xlink:actuate="onRequest" xlink:show="replace" priority="0" order="1.0"/> </presentationLink> <presentationLink xlink:type="extended" xlink:role="http://www.xbrl.org/2003/role/link"> <loc xlink:type="locator" xlink:href="sample_base.xsd#testroot" xlink:label="src"/> <loc xlink:type="locator" xlink:href="sample_base.xsd#test2" xlink:label="dest"/> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="src" xlink:to="dest" xlink:actuate="onRequest" xlink:show="replace" priority="0" order="1.0"/> </presentationLink> </linkbase>

--- Link document: link_over.xml ---

<?xml version="1.0" encoding="UTF-8"?> <linkbase xmlns="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink"> <presentationLink xlink:type="extended" xlink:role="http://www.xbrl.org/2003/role/link"> <loc xlink:type="locator" xlink:href="sample_base.xsd#testroot" xlink:label="src"/> <loc xlink:type="locator" xlink:href="sample_base.xsd#test2" xlink:label="dest"/> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="src" xlink:to="dest" xlink:actuate="onRequest" xlink:show="replace" priority="1" order="1" use="prohibited"/> </presentationLink> <presentationLink xlink:type="extended" xlink:role="http://www.xbrl.org/2003/role/link"> <loc xlink:type="locator" xlink:href="sample_base.xsd#testroot" xlink:label="src"/> <loc xlink:type="locator" xlink:href="sample_base.xsd#test2" xlink:label="dest"/> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="src" xlink:to="dest" xlink:actuate="onRequest" xlink:show="replace" priority="2" order="0.1"/> </presentationLink> </linkbase>

--- OverrideSample.java ---

import javax.xml.transform.stream.StreamSource; import com.fujitsu.xml.xbrl.xwand.common.LinkList; import com.fujitsu.xml.xbrl.xwand.common.RelationLink; import com.fujitsu.xml.xbrl.xwand.processor.XBRLProcessor; import com.fujitsu.xml.xbrl.xwand.taxonomy.ElementDecl; import com.fujitsu.xml.xbrl.xwand.taxonomy.PresentationLink; import com.fujitsu.xml.xbrl.xwand.taxonomy.TaxonomySet;

Page 78: XBRL Processor Development Guide - 富士通の …software.fujitsu.com/jp/manual/manualfiles/m120007/b1wd...iii Chapter 7 Specifications and Restrictions Chapter 7 explains the specifications

Appendix A Tutorial Source Code

72

class OverrideSample { public static void main(String args[]) throws Exception { XBRLProcessor xbrlProc = new XBRLProcessor(); //Document before overriding TaxonomySet taxonomySet = xbrlProc.loadTaxonomySet(new StreamSource("sample_base.xsd")); System.err.println("===== Before overriding ====="); test((PresentationLink)taxonomySet.getRootPresentationLinks().get(0)); System.err.println(); //Document after overriding taxonomySet = xbrlProc.loadTaxonomySet(new StreamSource("sample_over.xsd")); System.err.println("===== After overriding ====="); test((PresentationLink)taxonomySet.getRootPresentationLinks().get(0)); } public static void test(PresentationLink presentation) { LinkModelList childModels = presentation.getChildModels(RelationLink.FILTER_ORDERING, null, null); for (int cIndex = 0; cIndex < childModels.size(); cIndex++) { RelationLinkModel childModel = (RelationLinkModel)childModels.get(cIndex); PresentationLink pLink = (PresentationLink)childModel.getChildRelationLink(); System.err.println(((ElementDecl)pLink.getAnchor()).getName()); } } }

--- Console output ---

(Omitted) ===== Before overriding ===== test1 test2 (Omitted) ===== After overriding ===== test2 test1