com.ihr.xbrl.om.instance

## Class XBRLInstance

- java.lang.Object
- - com.ihr.xbrl.om.XMLFragment
  - - com.ihr.xbrl.om.XMLDocumentURI
    - - com.ihr.xbrl.om.XBRLDocument
      - - com.ihr.xbrl.om.instance.XBRLInstance

- All Implemented Interfaces:
    HasAdditionalEqualityForReassignation, XBRLRelationshipPoint, XBRLFactsList, Thinable, XBRLDTSDocument, XBRLHasDTSTarget, XBRLValidation, XMLHasParent, java.lang.Cloneable, javax.xml.namespace.NamespaceContext

      public class XBRLInstance
      extends XBRLDocument
      implements XBRLFactsList, java.lang.Cloneable

  Class that encapsulates the content of an XBRL instance document Instance documents can be created via API calls or can be created from the content of an XML file.
  Author:
    Ignacio

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.ihr.xbrl.om.XBRLValidation

      `XBRLValidation.Direction`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static javax.xml.namespace.QName` | `docNodeName` The document node name.

    - ### Fields inherited from class com.ihr.xbrl.om.XBRLDocument

      `INSTANCE, IXBRL, LINKBASE, TAXONOMY`

    - ### Fields inherited from class com.ihr.xbrl.om.XMLFragment

      `CONCEPT_LABEL, CONCEPT_QNAME, EASY_TO_READ, ELEMENT_LABEL, EMPTYRELATIONSHIPSITERATORINSTANCE, EMPTYXMLFRAGMENTITERATORINSTANCE, FACT_CONCEPT_DATATYPE, FACT_CONCEPT_LABEL, FACT_QNAME, HIDE_COMMON_ACCURACY, idQName, NO_POSITION, OrderComparator, OrderComparator2, PERIOD_TYPE, PERIOD_VALUE, SHORT_TEXT, SOURCE_DOCUMENT, XPATH, XPOINTER`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XBRLInstance(DTSContainer dts)` Creates a new empty instance document.
    `XBRLInstance(DTSContainer[] dtss)` Creates a new empty instance document and creates link:schemaRef and link:linkbaseRef elements to all root URIs of the DTSContainers received as a parameter.
    `XBRLInstance(DTSContainer dts, javax.xml.transform.Source xmlSource, boolean deepProcess)` Creates an instance document and obtains the content from a javax.xml.transform.Source object The Document URI of this instance will be set to the systemId of the Source provided as a parameter.
    `XBRLInstance(DTSContainer dts, net.sf.saxon.s9api.XdmNode doc, boolean bAddToCache)` Creates an instance document and sets the document content to the supplied XdmNode.
    `XBRLInstance(XMLDocumentURI d, boolean bAddToCache)` Creates a new empty instance document according to the configuration object received.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(int index, XBRLFact fact)` Adds the.
    `boolean` | `add(XBRLFact fact)` Adds a new fact to the end of this list of facts.
    `boolean` | `addContext(XBRLContext ctx)` Adds a new context to the instance document.
    `void` | `addFactToCache(XBRLFact fact)` Adds the fact to cache.
    `void` | `addOrForwardItem(XBRLFactItem item)` Called internally to register new facts in the instance document.
    `boolean` | `addUnit(XBRLUnit unit)` Adds the unit.
    `void` | `addXBRLDocument(XBRLDocument doc, XBRLRoleAndArcroleTypes roleOrArcrole)` Attach a new XBRLDocument directly in the instance regardless it is alreary somewhere under the wood of the DTS.
    `void` | `addXBRLDocumentIfNotInDTS(XBRLDocument doc, XBRLRoleAndArcroleTypes roleOrArcrole)` Attach a new XBRLDocument to the instance document using a linkbaseRef or schemaRed only if the document is not in already in the set of documents that can be discovered from this instance document existing DTS entries.
    `void` | `clear()` Frees-up used memory This method should not be invoqued on live objects in the DTS.
    `void` | `clearDTSReferences()` Removes all schemas, linkbases, roleRefs, arcroleRefs etc in the DTS of this instance document.
    `XBRLInstance` | `clone()`
    `void` | `copyHistory(XBRLInstance fromInstance)` This method copy all history details from instance in the fromInstance parameter to facts in this instance document.
    `void` | `delContext(XBRLContext ctx)` Removes a context from the instance document.
    `void` | `delUnit(XBRLUnit unit)` Removes an unit from the instance document.
    `void` | `delXBRLDocument(XBRLDocument doc)` Detach an XBRLDocument from the set of XBRLDocuments to include in this instance's DTS.
    `void` | `discoverDTS(XBRLDTSDocument parent)` This process MUST not use Schema Aware XPath expressions and MUST be limited to the elements that cause DTS Discovery.
    `boolean` | `equals(java.lang.Object obj)` Sets a new XPathFunctionResolver for this object.
    `org.jdom.Document` | `generateDocNode(boolean relativize, java.net.URI base)` Generates a JDOM representation of the instance document obtains information from the internal objects and not from the NodeInfo document.
    `XBRLFact` | `get(int index)` Returns the element at the selected index position.
    `XBRLFact` | `getCacheFact(net.sf.saxon.s9api.XdmNode factNode)` This function access to a fact item by its surrounding XdmNode.
    `XBRLContext` | `getContextById(java.lang.String id)` Gets the context by id.
    `XBRLContext` | `getContextCompatible(XBRLContext otherContext)` Returns an existing context that is c-equal to the context passed in as the parameter.
    `java.util.Iterator<XBRLContext>` | `getContexts()` Access to all contexts in the XBRL Instance.
    `int` | `getDTSDocumentType()` Returns the type of DTS Document.
    `java.lang.String` | `getDTSDocumentTypeName()` Gets the DTS document type name.
    `java.util.Iterator<java.net.URI>` | `getDTSs()` Obtains an iterator over the URIs of files that are in the DTS of this instance document.
    `java.util.Iterator<XMLFragment>` | `getElements()` For complex type resources this returns an iterator with all children XML fragments This method may be overwriten by other classes in the hierarchy.
    `XBRLFact` | `getFactById(java.lang.String id)` find the element with the correspondent id and return the instance or tuple pointed to.
    `XBRLInstance` | `getInstance()` Access to the instance document on the top of this facts container hierarchy.
    `java.util.Iterator<java.util.Vector<XBRLFactItem>>` | `getItems()` Iterator over the items on this facts container.
    `java.util.Iterator<XBRLFactItem>` | `getItems(XBRLItem itemFrom)` Iterator over fact items that are instances of the XBRLItem received as a parameter.
    `java.util.Iterator<XBRLFactItem>` | `getItemsSg(XBRLItem itemFrom)` Iterator over fact items that are instances of the XBRLItem received as a parameter of in the substitution group of that item.
    `int` | `getNumberOfContexts()` Returns the number of contexts in this instance document.
    `int` | `getNumberOfTuples()` Calculates and returns the number of tuples children of this facts container .
    `int` | `getNumberOfUnits()` Returns the number of units in this instance document.
    `XBRLFactsList` | `getParent()` The parent XMLFragment node of this XMLFragment node.
    `java.util.Iterator<java.util.Vector<XBRLFactTuple>>` | `getTuples()` Iterator over the tuples on this facts container.
    `java.util.Iterator<XBRLFactTuple>` | `getTuples(XBRLTuple tupleFrom)` Iterator over fact tuples that are instances of the XBRLTuple received as a parameter.
    `java.util.Iterator<XBRLFactTuple>` | `getTuplesSg(XBRLTuple tupleFrom)` Iterator over fact tuples that are instances of the XBRLTuple received as a parameter of in the substitution group of that tuple.
    `XBRLUnit` | `getUnitById(java.lang.String id)` Gets the unit by id.
    `XBRLUnit` | `getUnitCompatible(XBRLUnit otherUnit)` Returns an existing unit that is u-equal to the unit passed in as the parameter.
    `java.util.Iterator<XBRLUnit>` | `getUnits()` Gets the units.
    `net.sf.saxon.s9api.XdmValue` | `getValue()` Returns the value of this node.
    `java.util.Iterator<java.net.URI>` | `getXBRLDocuments(int type)` Returns an iterator over documents included in the DTS by this instance that are of the specified type.
    `java.lang.String` | `getXPathToRoot()` Returns an XPath 2.0 expression to locate this document's node starting at this document's root This function updates the local namespace context if nodes in the path requires new namespaces to be declared.
    `int` | `hashCode()` This is from the Object interface and must be implemented by sub classes in order to be able to provide hashCodes.
    `int` | `indexOf(XBRLFact fact)` Returns the index position of a fact within this list.
    `int` | `indexOf(XBRLFact fact, int index)` Returns the index position of a fact within this list starting at the position indicated by the index parameter.
    `static boolean` | `isIXBRL(XMLDocumentURI node)` Returns true if the XMLDocumentURI is an iXBRL document.
    `java.util.Iterator<XBRLFact>` | `iterator()` Iterator.
    `void` | `merge(XBRLInstance otherInstance)` Add to this instance document all the facts and contexts from the instance document in the parameter.
    `void` | `optimize(DTSContainer dts, boolean bRelativizeSchemaRefs, boolean bGenerateSchemalocation)` Optimize the instance document by removing unused elements
    `void` | `readInfoset()` Read all structures that builds the infoset.
    `boolean` | `remove(XBRLFact fact)` Removes a fact from the facts container.
    `void` | `setDocumentAndReload(net.sf.saxon.s9api.XdmNode node)` If the content is changed then update the internal objects.
    `void` | `setModified()` When a fact is edited this method is called to reflect that the nodes shall be generated again.
    `void` | `setOptimizations(boolean optimizations)` This flag sets how the process of generating the XML nodes will work either removing unused contexts or keeping all generated contexts there during a call to generateDocNode.
    `void` | `setParent(XBRLFactsList parent)` Sets the parent of this facts container to a new parent.
    `void` | `setURI(java.net.URI newURI)` Sets the value of the URI of this XMLDocumentURI If the document is in the cache and the supplied URI is not null or is different from the original URI this method throws an XBRLInternalErrorException.
    `int` | `size()` For complex type resources this returns the number of children elements that all are XML fragments This method may be overwriten by other classes in the hierarchy.
    `void` | `unsetModified()` Marks the instance as not modified.
    `boolean` | `updateXML(boolean relativize)` Updates the XML content of the XBRLDocument so the next call to save or to XdmNode getDocument() will obtain a fresh copy with all changes made in the object library.

    - ### Methods inherited from class com.ihr.xbrl.om.XBRLDocument

      `addExtendedLink, addIdOfElement, addIdOfElement, addParent, changeElementId, changeExtendedLinkKey, createDocument, createDocument, delParent, getAllUsedIds, getComments, getDocument, getDTS, getElementById, getExtendedLink, getExtendedLinks, getExtendedLinks, getParents, isContentModified, isDocumentModified, isIdUsed, moveNamespacesUp, moveNamespacesUp, removeExtendedLink, removeIdOfElement, save, setComments`

    - ### Methods inherited from class com.ihr.xbrl.om.XMLDocumentURI

      `addChild, delChild, generateLocatorToDocument, getBase, getChildren, getDocumentURI, getDTSKey, getLocalFile, getValidationReport, invalidate, invalidate, isInDTS, isOnValidation, validate`

    - ### Methods inherited from class com.ihr.xbrl.om.XMLFragment

      `addAttribute, addChild, addFromRelationship, addNamespace, addNamespace, addToRelationship, addXMLChild, changeBase, checkBase, clone, delAttribute, delAttribute, equalXdmValues, evaluateBoolean, evaluateList, evaluateNode, evaluateNumber, evaluateString, generateId, generateNode, generateNodeNamespacesAndAttributes, generateNodeValue, generatePrefix, getAllAttributes, getAttribute, getAttributeBooleanValue, getAttributeQNameValue, getAttributes, getAttributes, getAttributeStringValue, getAttributeValue, getBase, getBaseURI, getBooleanValue, getChild, getContainer, getContainerDocumentURI, getDeclaredNamespaces, getElementsHashCode, getFragment, getFriendlyName, getFriendlyName, getFromRelationships, getFromRelationships, getFromRelationships, getFromRelationships, getFromRelationships, getGenericLabelText, getId, getLang, getNamespaceURI, getNodeName, getNumberOfAttributes, getNumberOfElements, getNumberOfFromRelationships, getNumberOfToRelationships, getOrGenerateId, getPrefix, getPrefixes, getQNameValue, getRelationshipsBases, getRelationshipsChain, getRelationshipTypes, getStaticContext, getStaticNamespace, getStringValue, getToolTipText, getToRelationships, getToRelationships, getToRelationships, getToRelationships, getToRelationships, getXPathExecutable, getXPathNamespaceContext, getXPathToNode, getXPointerElementScheme, getXPointerElementScheme, getXPointerShorthandScheme, getXPointerToNode, isDead, isNamespaceDefined, isXdmDocumentAttached, objEquals, objHashCode, qNameToString, removeAttribute, removeChild, removeChild, removeFromRelationship, removeToRelationship, removeXMLChild, resetElements, resetHash, resolve_equal2, resolveHRef, resolveHRef, s_equal2, s_equal2, s_equal2, setAttributes, setBase, setDocument, setElements, setId, setLang, setNamespaceContext, setNamespaces, setNode, setNodeName, setParent, setRegenerateNodeIfnotFound, setValue, setValue, setVariablesDefined, thin, toString, valueEquals, xEqual`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.ihr.xbrl.om.instance.XBRLFactsList

      `evaluateList, getContainer, getDocument, isXdmDocumentAttached`

    - ### Methods inherited from interface com.ihr.xbrl.om.XMLHasParent

      `addXMLChild, getBase, removeXMLChild, setParent`

- - ### Field Detail

    - #### docNodeName

          public static final javax.xml.namespace.QName docNodeName

      The document node name.

  - ### Constructor Detail

    - #### XBRLInstance

          public XBRLInstance(DTSContainer dts,
                      net.sf.saxon.s9api.XdmNode doc,
                      boolean bAddToCache)
                       throws DTSDiscoveryException

      Creates an instance document and sets the document content to the supplied XdmNode. If the value of the bAddToCache parameter is true the document will be added to the documents cache in the DTS.
      Parameters:
        `dts` - the dts
        `doc` - the doc
        `bAddToCache` - the b add to cache
      Throws:
        `DTSDiscoveryException` - the DTS discovery exception

    - #### XBRLInstance

          public XBRLInstance(DTSContainer dts)

      Creates a new empty instance document.
      Parameters:
        `dts` - The DTSContainer under which this instance is going to be created

    - #### XBRLInstance

          public XBRLInstance(XMLDocumentURI d,
                      boolean bAddToCache)
                       throws DTSDiscoveryException

      Creates a new empty instance document according to the configuration object received. And the content of the XMLDocumentURI is supplied.

      This is an internal method and should not be used by applications. This method is called from the `XBRLDocument.createDocument(XMLDocumentURI, boolean)` method during the creation of an XBRL Instance document.

      This constructor is also used by `clone()` with bAddToCache set to false

      Parameters:
        `d` - XMLDocumentURI to transform into an XBRLInstance object
        `bAddToCache` - the b add to cache
      Throws:
        `DTSDiscoveryException` - the DTS discovery exception

    - #### XBRLInstance

          public XBRLInstance(DTSContainer[] dtss)
                       throws com.rs.lic.LicenseVerificationException

      Creates a new empty instance document and creates link:schemaRef and link:linkbaseRef elements to all root URIs of the DTSContainers received as a parameter.

      This method was created to facilitate instance document creation inside the formula linkbase.

      The incoming DTS are all merged into a new DTSContainer

      Parameters:
        `dtss` - the dtss
      Throws:
        `com.rs.lic.LicenseVerificationException` - the license verification exception

    - #### XBRLInstance

          public XBRLInstance(DTSContainer dts,
                      javax.xml.transform.Source xmlSource,
                      boolean deepProcess)
                       throws net.sf.saxon.s9api.SaxonApiException,
                              DTSDiscoveryException

      Creates an instance document and obtains the content from a javax.xml.transform.Source object

      The Document URI of this instance will be set to the systemId of the Source provided as a parameter. The Source will be transformed into XML nodes and the nodes will be the new document content.

      Parameters:
        `dts` - The DTSContainer under which the instance document is going to be created
        `xmlSource` - The Source of the XML nodes to be read
        `deepProcess` - boolean, true if the xmlSource is schema validated and nodes can be processed. false otherwise
      Throws:
        `net.sf.saxon.s9api.SaxonApiException` - in case of problems reading the Source
        `DTSDiscoveryException` - the DTS discovery exception

  - ### Method Detail

    - #### hashCode

          public int hashCode()

      Description copied from interface: `XBRLFactsList`
      This is from the Object interface and must be implemented by sub classes in order to be able to provide hashCodes.
      Specified by:
        `hashCode` in interface `XBRLFactsList`
      Overrides:
        `hashCode` in class `XBRLDocument`
      Returns:
        integer

    - #### equals

          public boolean equals(java.lang.Object obj)

      Description copied from class: `XMLFragment`
      Sets a new XPathFunctionResolver for this object.
      Specified by:
        `equals` in interface `XBRLFactsList`
      Overrides:
        `equals` in class `XBRLDocument`
      Parameters:
        `obj` - the other
      Returns:
        true, if successful

    - #### clone

          public XBRLInstance clone()

      Overrides:
        `clone` in class `XMLFragment`

    - #### clear

          public void clear()
                     throws java.lang.Throwable

      Description copied from class: `XMLFragment`
      Frees-up used memory

      This method should not be invoqued on live objects in the DTS. It is automatically invoqued by the API when an object is no longer used and referenced by other objects. It is save not to call it directly.

      Specified by:
        `clear` in interface `XBRLFactsList`
      Specified by:
        `clear` in interface `XBRLDTSDocument`
      Overrides:
        `clear` in class `XBRLDocument`
      Throws:
        `java.lang.Throwable` - the throwable

    - #### getDTSDocumentType

          public int getDTSDocumentType()

      Description copied from class: `XBRLDocument`
      Returns the type of DTS Document.
      Specified by:
        `getDTSDocumentType` in class `XBRLDocument`
      Returns:
        DTSDocument.INSTANCE, DTSDocument.TAXONOMY or DTSDocument.LINKBASE

    - #### addFactToCache

          public void addFactToCache(XBRLFact fact)

      Adds the fact to cache. This method shall not be used by applications. It is used internally by the formula processor
      Parameters:
        `fact` - the fact

    - #### updateXML

          public boolean updateXML(boolean relativize)
                            throws XBRLSerializationException

      Description copied from class: `XBRLDocument`
      Updates the XML content of the XBRLDocument so the next call to save or to XdmNode getDocument() will obtain a fresh copy with all changes made in the object library. note this method does not propagate the changes inside the object in the XBRL api that are down on this XBRLDocument. so formula validation accessing facts will not work.
      Overrides:
        `updateXML` in class `XBRLDocument`
      Parameters:
        `relativize` - boolean value indicating if URLs (in locators, linkbaseRefs, etc...) will be relativized using the document URL as a base URL.
      Returns:
        true if the document has been updated, false if the document has not been modified
      Throws:
        `XBRLSerializationException` - the XBRL serialization exception

    - #### getCacheFact

          public XBRLFact getCacheFact(net.sf.saxon.s9api.XdmNode factNode)

      This function access to a fact item by its surrounding XdmNode. It is obtained from an internal cache. This function is used inside the formula processor in order to accelerate access to high level objects while working with low level Saxon API.

      At this stage, the use of this method is only possible for instance documents obtained from the serialized form (XML files).

      Parameters:
        `factNode` - as key to obtain the XBRLFact
      Returns:
        XBRLFact
      Since:
        2.7.0

    - #### addContext

          public boolean addContext(XBRLContext ctx)
                             throws XBRLInconsistentDTSException

      Adds a new context to the instance document. Normally contexts are added automatically when a fact is added to a container. This method is here to add contexts to an instance document that are not associated to any fact. The method raises an XBRLInconsistentDTSException if the instance will have two contexts for the same ID This method does not compare the contexts for s_equality. Two s_equal contexts with different IDs may exist in an instance document.
      Parameters:
        `ctx` - the ctx
      Returns:
        true if the context is new false if the context already exists
      Throws:
        `XBRLInconsistentDTSException` - the XBRL inconsistent dts exception

    - #### getContextCompatible

          public XBRLContext getContextCompatible(XBRLContext otherContext)

      Returns an existing context that is c-equal to the context passed in as the parameter.
      Parameters:
        `otherContext` - the other context
      Returns:
        the context compatible
      Since:
        2.8.5

    - #### getUnitCompatible

          public XBRLUnit getUnitCompatible(XBRLUnit otherUnit)

      Returns an existing unit that is u-equal to the unit passed in as the parameter.
      Parameters:
        `otherUnit` - the other unit
      Returns:
        the unit compatible
      Since:
        2.8.5

    - #### delContext

          public void delContext(XBRLContext ctx)

      Removes a context from the instance document.

      The context should not have fact items in this instance document before it is removed.

      All facts in the instance document using this context will be removed from the instance

      Parameters:
        `ctx` - the ctx

    - #### delUnit

          public void delUnit(XBRLUnit unit)
                       throws XBRLInconsistentDTSException

      Removes an unit from the instance document. The unit must not be used by items in this instance document before it is removed. An XBRLInconsistentOperationException is thrown if this happens
      Parameters:
        `unit` - the unit
      Throws:
        `XBRLInconsistentDTSException` - the XBRL inconsistent dts exception

    - #### getFactById

          public XBRLFact getFactById(java.lang.String id)
                               throws XBRLValidationException

      find the element with the correspondent id and return the instance or tuple pointed to.
      Parameters:
        `id` - the id
      Returns:
        XMLFragment
      Throws:
        `XBRLValidationException` - the XBRL validation exception

    - #### merge

          public void merge(XBRLInstance otherInstance)

      Add to this instance document all the facts and contexts from the instance document in the parameter.
      Parameters:
        `otherInstance` - is the document to include into this document

    - #### setDocumentAndReload

          public void setDocumentAndReload(net.sf.saxon.s9api.XdmNode node)
                                    throws XBRLInconsistentDTSException,
                                           com.rs.lic.LicenseVerificationException

      If the content is changed then update the internal objects.
      Overrides:
        `setDocumentAndReload` in class `XBRLDocument`
      Parameters:
        `node` - the new document and reload
      Throws:
        `XBRLInconsistentDTSException` - the XBRL inconsistent dts exception
        `com.rs.lic.LicenseVerificationException` - the license verification exception

    - #### optimize

          public void optimize(DTSContainer dts,
                      boolean bRelativizeSchemaRefs,
                      boolean bGenerateSchemalocation)

      Optimize the instance document by removing unused elements. - unreferenced context are removed - unreferenced units are removed
      Parameters:
        `dts` - the dts
        `bRelativizeSchemaRefs` - turn the content of xlink:href relative to the documentURI
        `bGenerateSchemalocation` - creates a xsi:schemaLocation element

    - #### getDTSDocumentTypeName

          public java.lang.String getDTSDocumentTypeName()

      Description copied from class: `XBRLDocument`
      Gets the DTS document type name.
      Specified by:
        `getDTSDocumentTypeName` in class `XBRLDocument`
      Returns:
        the DTS document type name

    - #### getValue

          public net.sf.saxon.s9api.XdmValue getValue()

      Description copied from class: `XMLFragment`
      Returns the value of this node. If the value has been set to a jdom node then this function returns null If getDocument() is null then this function returns an empty sequence If getDocument() is not null this function tries to return an atomic value this function should be overridden by objects in this API
      Overrides:
        `getValue` in class `XMLFragment`
      Returns:
        a net.sf.saxon.s9api.XdmValue

    - #### setOptimizations

          public void setOptimizations(boolean optimizations)

      This flag sets how the process of generating the XML nodes will work either removing unused contexts or keeping all generated contexts there during a call to generateDocNode. The default value is to work with optimizations disabled so the API will not remove elements created by the API. When it is time to save the intance on disk it may be apropriate to set this to true.
      Parameters:
        `optimizations` - the new optimizations

    - #### generateDocNode

          public org.jdom.Document generateDocNode(boolean relativize,
                                          java.net.URI base)
                                            throws XBRLSerializationException

      Generates a JDOM representation of the instance document obtains information from the internal objects and not from the NodeInfo document. The NodeInfo document is not updated
      Specified by:
        `generateDocNode` in class `XBRLDocument`
      Parameters:
        `relativize` - the relativize
        `base` - the base
      Returns:
        org.jdom.Document
      Throws:
        `XBRLSerializationException` - the XBRL serialization exception

    - #### setURI

          public void setURI(java.net.URI newURI)
                      throws DTSDiscoveryException

      Description copied from class: `XMLDocumentURI`
      Sets the value of the URI of this XMLDocumentURI If the document is in the cache and the supplied URI is not null or is different from the original URI this method throws an XBRLInternalErrorException.
      Overrides:
        `setURI` in class `XMLDocumentURI`
      Parameters:
        `newURI` - URI
      Throws:
        `DTSDiscoveryException` - the DTS discovery exception

    - #### discoverDTS

          public void discoverDTS(XBRLDTSDocument parent)
                           throws DTSDiscoveryException,
                                  com.rs.lic.LicenseVerificationException

      This process MUST not use Schema Aware XPath expressions and MUST be limited to the elements that cause DTS Discovery.
      Specified by:
        `discoverDTS` in interface `XBRLDTSDocument`
      Specified by:
        `discoverDTS` in class `XBRLDocument`
      Parameters:
        `parent` - the parent
      Throws:
        `DTSDiscoveryException` - the DTS discovery exception
        `com.rs.lic.LicenseVerificationException` - the license verification exception

    - #### getContexts

          public java.util.Iterator<XBRLContext> getContexts()

      Access to all contexts in the XBRL Instance. If the instance document has been created from an external file this function may return duplicate XBRL Contexts in the iterator. If the XBRL Instance has been created from the API, the API already eliminates duplicate contexts automatically.

      Note that the serialization process will eliminate duplicate contexts automatically if they exists.

      Returns:
        Iterator over all XBRL contexts in the instance.

    - #### getNumberOfContexts

          public int getNumberOfContexts()

      Returns the number of contexts in this instance document.
      Returns:
        Integer value

    - #### getNumberOfUnits

          public int getNumberOfUnits()

      Returns the number of units in this instance document.
      Returns:
        Integer value

    - #### getUnits

          public java.util.Iterator<XBRLUnit> getUnits()

      Gets the units.
      Returns:
        the units

    - #### addXBRLDocumentIfNotInDTS

          public void addXBRLDocumentIfNotInDTS(XBRLDocument doc,
                                       XBRLRoleAndArcroleTypes roleOrArcrole)
                                         throws XBRLValidationException

      Attach a new XBRLDocument to the instance document using a linkbaseRef or schemaRed only if the document is not in already in the set of documents that can be discovered from this instance document existing DTS entries.

      The document to attach MUST have a URI. The roleOrArcrole parameter may be null and is null in if the doc parameter is a taxonomy schema.

      Parameters:
        `doc` - the new XBRLTaxonomy or XBRLLinkbase to attach
        `roleOrArcrole` - XBRLRoleAndArcroleTypes, optional
      Throws:
        `XBRLValidationException` - the XBRL validation exception
      See Also:
        `addXBRLDocument(XBRLDocument, XBRLRoleAndArcroleTypes)`

    - #### addXBRLDocument

          public void addXBRLDocument(XBRLDocument doc,
                             XBRLRoleAndArcroleTypes roleOrArcrole)

      Attach a new XBRLDocument directly in the instance regardless it is alreary somewhere under the wood of the DTS. The document to be attached MUST have a URI
      Parameters:
        `doc` - the new XBRLTaxonomy or XBRLLinkbase to attach
        `roleOrArcrole` - XBRLRoleAndArcroleTypes can be null and is null for taxonomy and linkbase documents
      See Also:
        `addXBRLDocumentIfNotInDTS(XBRLDocument, XBRLRoleAndArcroleTypes)`

    - #### setModified

          public void setModified()

      When a fact is edited this method is called to reflect that the nodes shall be generated again.

    - #### unsetModified

          public void unsetModified()

      Marks the instance as not modified. This operation is used by the GUI after having loaded the instante in the GUI because the creation of temporary contexts changes the intenal modified flag. In next releases this method might be removed.

    - #### getXBRLDocuments

          public java.util.Iterator<java.net.URI> getXBRLDocuments(int type)

      Returns an iterator over documents included in the DTS by this instance that are of the specified type.
      Parameters:
        `type` - can be XBRLDocument.TAXONOMY or XBRLDocument.LINKBASE
      Returns:
        Iterator

    - #### delXBRLDocument

          public void delXBRLDocument(XBRLDocument doc)

      Detach an XBRLDocument from the set of XBRLDocuments to include in this instance's DTS.
      Parameters:
        `doc` - the XBRLTaxonomy or XBRLLinkbase to detach

    - #### getDTSs

          public java.util.Iterator<java.net.URI> getDTSs()
                                                   throws XBRLValidationException

      Obtains an iterator over the URIs of files that are in the DTS of this instance document.
      Returns:
        Iterator
      Throws:
        `XBRLValidationException` - the XBRL validation exception

    - #### getContextById

          public XBRLContext getContextById(java.lang.String id)
                                     throws XBRLValidationException

      Gets the context by id.
      Parameters:
        `id` - the id
      Returns:
        the context by id
      Throws:
        `XBRLValidationException` - the XBRL validation exception

    - #### getUnitById

          public XBRLUnit getUnitById(java.lang.String id)
                               throws XBRLValidationException

      Gets the unit by id.
      Parameters:
        `id` - the id
      Returns:
        the unit by id
      Throws:
        `XBRLValidationException` - the XBRL validation exception

    - #### readInfoset

          public void readInfoset()
                           throws XBRLValidationException

      Description copied from class: `XBRLDocument`
      Read all structures that builds the infoset.
      Specified by:
        `readInfoset` in class `XBRLDocument`
      Throws:
        `XBRLValidationException` - the XBRL validation exception

    - #### addUnit

          public boolean addUnit(XBRLUnit unit)
                          throws XBRLInconsistentDTSException

      Adds the unit.
      Parameters:
        `unit` - the unit
      Returns:
        true, if successful
      Throws:
        `XBRLInconsistentDTSException` - the XBRL inconsistent dts exception

    - #### getElements

          public java.util.Iterator<XMLFragment> getElements()

      Description copied from class: `XMLFragment`
      For complex type resources this returns an iterator with all children XML fragments This method may be overwriten by other classes in the hierarchy.
      Overrides:
        `getElements` in class `XMLFragment`
      Returns:
        Iterator

    - #### getXPathToRoot

          public java.lang.String getXPathToRoot()

      Description copied from class: `XMLFragment`
      Returns an XPath 2.0 expression to locate this document's node starting at this document's root This function updates the local namespace context if nodes in the path requires new namespaces to be declared.
      Specified by:
        `getXPathToRoot` in interface `XBRLFactsList`
      Overrides:
        `getXPathToRoot` in class `XMLFragment`
      Returns:
        String

    - #### add

          public boolean add(XBRLFact fact)

      Description copied from interface: `XBRLFactsList`
      Adds a new fact to the end of this list of facts.
      Specified by:
        `add` in interface `XBRLFactsList`
      Parameters:
        `fact` - the fact
      Returns:
        true, if successful

    - #### add

          public void add(int index,
                 XBRLFact fact)

      Description copied from interface: `XBRLFactsList`
      Adds the.
      Specified by:
        `add` in interface `XBRLFactsList`
      Parameters:
        `index` - the index
        `fact` - the fact

    - #### getInstance

          public XBRLInstance getInstance()

      Description copied from interface: `XBRLFactsList`
      Access to the instance document on the top of this facts container hierarchy.
      Specified by:
        `getInstance` in interface `XBRLFactsList`
      Returns:
        XBRLInstance

    - #### getItems

          public java.util.Iterator<java.util.Vector<XBRLFactItem>> getItems()

      Description copied from interface: `XBRLFactsList`
      Iterator over the items on this facts container.
      Specified by:
        `getItems` in interface `XBRLFactsList`
      Returns:
        Iterator<Vector<XBRLFactItem>>

    - #### getItems

          public java.util.Iterator<XBRLFactItem> getItems(XBRLItem itemFrom)

      Description copied from interface: `XBRLFactsList`
      Iterator over fact items that are instances of the XBRLItem received as a parameter.
      Specified by:
        `getItems` in interface `XBRLFactsList`
      Parameters:
        `itemFrom` - XBRLItem
      Returns:
        Iterator<XBRLFactItem>

    - #### getParent

          public XBRLFactsList getParent()

      Description copied from class: `XMLFragment`
      The parent XMLFragment node of this XMLFragment node.

      For XBRLAttribute nodes, the parent is the element node.

      For Document nodes the returned value is null

      For Embedded document nodes, the returned value is the parent element node.

      Specified by:
        `getParent` in interface `XBRLFactsList`
      Specified by:
        `getParent` in interface `XMLHasParent`
      Overrides:
        `getParent` in class `XMLFragment`
      Returns:
        the parent XMLFragment possible parents are: XBRLItem, XBRLTuple, XBRLImport, XBRLLinkbase, XBRLExtendedLink, XBRLDocumentation, XBRLRelationship, XBRLResource.

    - #### getTuples

          public java.util.Iterator<java.util.Vector<XBRLFactTuple>> getTuples()

      Description copied from interface: `XBRLFactsList`
      Iterator over the tuples on this facts container.
      Specified by:
        `getTuples` in interface `XBRLFactsList`
      Returns:
        Iterator<Vector<XBRLFactTuple>>

    - #### getItemsSg

          public java.util.Iterator<XBRLFactItem> getItemsSg(XBRLItem itemFrom)

      Description copied from interface: `XBRLFactsList`
      Iterator over fact items that are instances of the XBRLItem received as a parameter of in the substitution group of that item.
      Specified by:
        `getItemsSg` in interface `XBRLFactsList`
      Parameters:
        `itemFrom` - XBRLItem
      Returns:
        Iterator<XBRLFactItem>

    - #### getTuplesSg

          public java.util.Iterator<XBRLFactTuple> getTuplesSg(XBRLTuple tupleFrom)

      Description copied from interface: `XBRLFactsList`
      Iterator over fact tuples that are instances of the XBRLTuple received as a parameter of in the substitution group of that tuple.
      Specified by:
        `getTuplesSg` in interface `XBRLFactsList`
      Parameters:
        `tupleFrom` - the tuple from
      Returns:
        Iterator<XBRLFactTuple>

    - #### getTuples

          public java.util.Iterator<XBRLFactTuple> getTuples(XBRLTuple tupleFrom)

      Description copied from interface: `XBRLFactsList`
      Iterator over fact tuples that are instances of the XBRLTuple received as a parameter.
      Specified by:
        `getTuples` in interface `XBRLFactsList`
      Parameters:
        `tupleFrom` - XBRLTuple
      Returns:
        Iterator<XBRLFactTuple>

    - #### iterator

          public java.util.Iterator<XBRLFact> iterator()

      Description copied from interface: `XBRLFactsList`
      Iterator.
      Specified by:
        `iterator` in interface `XBRLFactsList`
      Returns:
        the iterator

    - #### getNumberOfTuples

          public int getNumberOfTuples()

      Description copied from interface: `XBRLFactsList`
      Calculates and returns the number of tuples children of this facts container .
      Specified by:
        `getNumberOfTuples` in interface `XBRLFactsList`
      Returns:
        integer value

    - #### remove

          public boolean remove(XBRLFact fact)

      Description copied from interface: `XBRLFactsList`
      Removes a fact from the facts container.
      Specified by:
        `remove` in interface `XBRLFactsList`
      Parameters:
        `fact` - the fact
      Returns:
        boolean

    - #### setParent

          public void setParent(XBRLFactsList parent)

      Description copied from interface: `XBRLFactsList`
      Sets the parent of this facts container to a new parent.
      Specified by:
        `setParent` in interface `XBRLFactsList`
      Parameters:
        `parent` - the new parent

    - #### addOrForwardItem

          public void addOrForwardItem(XBRLFactItem item)

      Description copied from interface: `XBRLFactsList`
      Called internally to register new facts in the instance document.
      Specified by:
        `addOrForwardItem` in interface `XBRLFactsList`
      Parameters:
        `item` - the item

    - #### size

          public int size()

      Description copied from class: `XMLFragment`
      For complex type resources this returns the number of children elements that all are XML fragments This method may be overwriten by other classes in the hierarchy.
      Specified by:
        `size` in interface `XBRLFactsList`
      Overrides:
        `size` in class `XMLFragment`
      Returns:
        integer

    - #### indexOf

          public int indexOf(XBRLFact fact)

      Description copied from interface: `XBRLFactsList`
      Returns the index position of a fact within this list.
      Specified by:
        `indexOf` in interface `XBRLFactsList`
      Parameters:
        `fact` - XBRLFact
      Returns:
        integer

    - #### indexOf

          public int indexOf(XBRLFact fact,
                    int index)

      Description copied from interface: `XBRLFactsList`
      Returns the index position of a fact within this list starting at the position indicated by the index parameter.
      Specified by:
        `indexOf` in interface `XBRLFactsList`
      Parameters:
        `fact` - XBRLFact
        `index` - integer
      Returns:
        integer

    - #### get

          public XBRLFact get(int index)

      Description copied from interface: `XBRLFactsList`
      Returns the element at the selected index position. The first element is at position 0
      Specified by:
        `get` in interface `XBRLFactsList`
      Parameters:
        `index` - integer
      Returns:
        XBRLFact at position indicated by index parameter

    - #### isIXBRL

          public static boolean isIXBRL(XMLDocumentURI node)

      Returns true if the XMLDocumentURI is an iXBRL document. False otherwise
      Parameters:
        `node` - the node
      Returns:
        true, if is ixbrl

    - #### clearDTSReferences

          public void clearDTSReferences()

      Removes all schemas, linkbases, roleRefs, arcroleRefs etc in the DTS of this instance document. This also removes all fact items in the instance but does not removes contexts and units.

    - #### copyHistory

          public void copyHistory(XBRLInstance fromInstance)

      This method copy all history details from instance in the fromInstance parameter to facts in this instance document.
      Parameters:
        `fromInstance` - the instance document whose facts history is going to be copied into this instance facts