com.ihr.xbrl.om
Class XMLFragment

java.lang.Object
  extended by com.ihr.xbrl.om.XMLFragment
All Implemented Interfaces:
XBRLRelationshipPoint, XMLHasParent, java.lang.Cloneable, javax.xml.namespace.NamespaceContext
Direct Known Subclasses:
MapperContextBase, MapperPeriodBase, XBRLAttribute, XBRLContext, XBRLDimensionsContainer, XBRLDocumentation, XBRLEntity, XBRLFact, XBRLImport, XBRLInclude, XBRLMeasure, XBRLPeriod, XBRLRoleAndArcroleTypes, XBRLUnit, XBRLUsedOn, XLinkElement, XMLDocumentURI, XMLElementDefinition

public class XMLFragment
extends java.lang.Object
implements javax.xml.namespace.NamespaceContext, XBRLRelationshipPoint, java.lang.Cloneable, XMLHasParent

This is the bottom class of almost every object on this API that represents a node in an XML document.

Methods of this class allows to execute XPath expressions using this node as the context for the XPath expressions. Other methods allows to obtain the XPointers in different formats. Other set of methods keeps track of XLink relationships between the nodes.

Author:
Ignacio

Field Summary
static int CONCEPT_LABEL
          Constant used to indicate formatting options for the friendly name of an object
static int CONCEPT_QNAME
          Constant used to indicate formatting options for the friendly name of an object
static EmptyIterator<XBRLRelationship> EMPTYRELATIONSHIPSITERATORINSTANCE
          Implements an empty Iterator over relationships returned when there are no relationships to iterate over
static EmptyIterator<XMLFragment> EMPTYXMLFRAGMENTITERATORINSTANCE
          Implements an empty Iterator over XMLFragments returned when there are no XMLFragments to iterate over
static int FACT_CONCEPT_DATATYPE
          Includes the fact data type in the fact friendly name string.
static int FACT_CONCEPT_LABEL
          Constant used to indicate formatting options for the friendly name of an object
static int FACT_QNAME
          Constant used to indicate formatting options for the friendly name of an object
static javax.xml.namespace.QName idQName
          This is the name of the attribute id defined here for convenience the id QName is in the no namespace and has no prefix
static int NO_POSITION
          Constant used to indicate formatting options for the friendly name of an object
static java.util.Comparator<XBRLRelationship> OrderComparator
          class to compare two relationships based on the value of the order attribute and order a set of arcs accordingly
static int PERIOD_TYPE
          Includes the period type description after the period value
static int PERIOD_VALUE
          Includes the period value on XBRLPeriod instances
static int SHORT_TEXT
          for resources, this returns the resource text, the id, the xlink:label or the node name in that order
static int SOURCE_DOCUMENT
          Constant used to indicate formatting options for the friendly name of an object
static int XPATH
          Constant used to indicate formatting options for the friendly name of an object
static int XPOINTER
          Constant used to indicate formatting options for the friendly name of an object
 
Constructor Summary
XMLFragment(DTSContainer dts)
          Creates a new XMLFragment object in a DTS
XMLFragment(DTSContainer newDTS, XMLFragment other)
          Copy all properties from the other object but sets the DTS to a new one.
XMLFragment(XMLFragment other)
          Copy constructor for an XMLFragment
 
Method Summary
 void addAttribute(XBRLAttribute value)
          Adds a new attribute to the set of attributes for this XMLFragment
 void addChild(XMLFragment f)
          Sets the resource value to a comples type value and adds a fragment to it
 void addFromRelationship(XBRLRelationship rel)
           
 void addNamespace(org.jdom.Namespace ns)
          Adds a namespace declaration that will be in the scope of namespaces declared in this node.
 void addNamespace(java.lang.String prefix, java.lang.String uri)
          Adds a new namespace and prefix to this object's namespace context.
 void addToRelationship(XBRLRelationship rel)
           
 void addXMLChild(XMLHasParent newChild)
           
 void changeBase(DTSBase oldBase, DTSBase newBase)
          This object is informed that a DTSBase is going to be deleted.
static void checkBase(boolean relativize, java.net.URI base)
          For internal use only.
 void clear()
          Frees-up used memory This method should not be invoqued on live objects in the DTS.
 XMLFragment clone()
           
 XMLFragment clone(DTSContainer newDTS)
           
 void delAttribute(javax.xml.namespace.QName attributeQName)
          Removes an attribute from the attributes defined for this XMLFragment
 void delAttribute(XBRLAttribute attribute)
           
 boolean equals(java.lang.Object other)
          Sets a new XPathFunctionResolver for this object
static boolean equalXdmValues(net.sf.saxon.s9api.XdmValue val, net.sf.saxon.s9api.XdmValue val2)
          Compares two XdmValue objects and return true if both are the same atomicValues or the same XML nodes.
 java.lang.Boolean evaluateBoolean(java.lang.String strXPath)
          Evaluates an XPath 2.0 expression using this node as the evaluation conetxt.
 net.sf.saxon.s9api.XdmValue evaluateList(java.lang.String strXPath)
          Evaluates an XPath 2.0 expression using this node as the evaluation context.
 net.sf.saxon.s9api.XdmItem evaluateNode(java.lang.String strXPath)
          Evaluates an XPath 2.0 expression using this node as the evaluation conetxt.
 java.lang.Double evaluateNumber(java.lang.String strXPath)
          Evaluates an XPath 2.0 expression using this node as the evaluation context.
 java.lang.String evaluateString(java.lang.String strXPath)
          Evaluates an XPath 2.0 expression using this node as the evaluation conetxt.
static java.lang.String generateId()
          Generates a new unique ID that can be used during the serialization of objects
 org.jdom.Content generateNode(boolean relativize, java.net.URI base)
          Serializes to a jdom Element the representation of the properties of this Information Item This method should be called from classes derived from this class
 void generateNodeNamespacesAndAttributes(org.jdom.Content jdomNode)
          Adds namespaces and attributes in this node to the Content node supplied as a parameter
 void generateNodeValue(org.jdom.Element jdomNode)
           
static java.lang.String generatePrefix(java.lang.String namespace)
          Returns a prefix that is created automatically and bounds it to the namespace
 XBRLAttribute getAttribute(javax.xml.namespace.QName attributeName)
          Obtains an XBRLAttribute object that is defined in this XMLFragment or null if not found
 javax.xml.namespace.QName getAttributeQNameValue(javax.xml.namespace.QName attributeName)
          Returns a Value object with the value of the attribute on this node.
 java.util.Iterator<XBRLAttribute> getAttributes()
          Access to attributes defined in this node.
static XBRLAttribute[] getAttributes(DTSContainer dts, net.sf.saxon.s9api.XdmNode node)
          Returns an array of attributes in the node supplied as a parameter
 java.lang.String getAttributeStringValue(javax.xml.namespace.QName attributeName)
          Returns a String with the value of the attribute on this node.
 net.sf.saxon.value.AtomicValue getAttributeValue(javax.xml.namespace.QName attributeName)
          Returns a Value object with the value of the attribute on this node.
 java.net.URI getBase()
          Search for an attribute called xml:base on this node and returns the resulting URI
 java.net.URI getBase(java.net.URI base)
          Search for an attribute called xml:base on this node if set, then resolves the base URI against that attribute and returns the resulting URI
 java.lang.String getBaseURI()
           
 boolean getBooleanValue()
          If the value is a Boolean type value then Boolean value is extracted and returned as a boolean.
 XMLFragment getChild(int index)
          Direct access to the nth child node from this node as parent.
 DTSContainer getContainer()
          Returns the DTS Container object
 java.net.URI getContainerDocumentURI()
          Try to obtain this document URI.
 java.util.Iterator<org.jdom.Namespace> getDeclaredNamespaces()
          Access to the set of declared namespaces in this node.
 net.sf.saxon.s9api.XdmNode getDocument()
          Returns the surrounding XML Node
 java.util.Iterator<XMLFragment> getElements()
          For complex type resources this returns an iterator with all children XML fragments Tthis method may be overwriten by other classes in the hierarchy
 java.lang.String getFragment(java.lang.String href)
          Returns the fragment part of an href.
 java.lang.String getFriendlyName()
          Returns a string description that represents the element content in a form that users can understand.
 java.lang.String getFriendlyName(int modifiers, LabelsProvider lp)
          Returns a string description that represents the element content in a form that users can understand.
 java.util.Iterator<XBRLRelationship> getFromRelationships()
          Returns the relationship objects that contains this element in the source of the relationship
 java.util.Iterator<XBRLRelationship> getFromRelationships(XBRLArcroleType arcrole)
          Obtains an iterator over all relationships where this fragment is the source of the relationship and the arcrole corresponds to the parameter indicated.
 java.util.Iterator<XBRLRelationship> getFromRelationships(XBRLArcroleType arcrole, DTSBase base)
          Returns the relationship objects that contains this element in the source of the relationship using a filter on the arcrole value
 java.util.Collection<XBRLRelationship> getFromRelationships(XBRLArcroleType arcrole, DTSBase base, java.util.Comparator<XBRLRelationship> comparator)
          Returns a collection of relationship objects that contains this element in the source of the relationship using a filter on the arcrole value and that belongs to a specific base.
 java.lang.String getId()
          Access to the element's id.
 java.lang.String getLang()
          Returns the value of the xml:lang attribute on this node or on a parent node Returns null if not specified on this or any parent node
 java.lang.String getNamespaceURI(java.lang.String prefix)
          Returns the namespace URI for the specified prefix as defined in this node
 javax.xml.namespace.QName getNodeName()
          Returns this node's name as a QName.
 int getNumberOfElements()
          If this node has child nodes this method returns how many nodes are there.
 int getNumberOfFromRelationships()
          Returns the number of relationships this fragment is in its source
 int getNumberOfToRelationships()
          Returns the number of relationships this fragment is in its target
 java.lang.String getOrGenerateId()
          Obtain the id for this XMLFragment. if not set then this method will create one unique ID and will set it as the ID for this XMLFragment.
 XMLHasParent getParent()
          The parent XMLFragment node of this XMLFragment node.
 java.lang.String getPrefix(java.lang.String namespaceURI)
          Returns the prefix String associated to the given URI as defined in this node
 java.util.Iterator<?> getPrefixes(java.lang.String namespaceURI)
           
 javax.xml.namespace.QName getQNameValue()
          Returns this XMLFragment value as a QName If the value is a QName type value the QName is extracted and returned as a QName.
 java.util.Iterator<DTSBase> getRelationshipsBases()
          Returns an iterator over all DTSBases this object has relationships from
 java.util.Iterator<XBRLRelationshipsChainLink> getRelationshipsChain(DTSBase base, javax.xml.namespace.QName type)
          Process all relationships this item is source and returns an iterator over all XBRLRelationshipsChainLink(s)
 java.util.Iterator<javax.xml.namespace.QName> getRelationshipTypes(DTSBase base)
          Returns an iterator over all QNames of relationship types that exists in a specific base
static java.lang.String getStaticNamespace(java.lang.String prefix)
          Returns the namespace URI for a prefix.
 java.lang.String getStringValue()
          Returns a string representation of the value of this XMLFragment if value is null the function returns null
 java.util.Iterator<XBRLRelationship> getToRelationships()
          Returns the relationship objects that contains this element in the target of the relationship
 java.util.Iterator<XBRLRelationship> getToRelationships(XBRLArcroleType arcrole)
          Obtains an iterator over all relationships where this fragment is the target of the relationship and the arcrole corresponds to the parameter indicated.
 java.util.Iterator<XBRLRelationship> getToRelationships(XBRLArcroleType arcrole, DTSBase base)
          Returns the relationship objects that contains this element in the target of the relationship or null if there is none
 java.util.Collection<XBRLRelationship> getToRelationships(XBRLArcroleType arcrole, DTSBase base, java.util.Comparator<XBRLRelationship> comparator)
          Returns a collection of relationship objects that contains this element in the target of the relationship using a filter on the arcrole value and that belongs to a specific base.
 net.sf.saxon.s9api.XdmValue getValue()
          Returns the value of this node.
 net.sf.saxon.om.NamespaceResolver getXPathNamespaceContext()
          Access to the NamespaceResolver attached to this XMLFragment
 java.lang.String getXPathToNode(net.sf.saxon.om.NodeInfo node)
          Builds an XPath2 expression that points to the node received as a parameter.
 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.
 java.lang.String getXPointerElementScheme()
          generates an XPointer of the form element(/n/m/...) pointing to the node that is the nodeInfo of this fragment
static java.lang.String getXPointerElementScheme(net.sf.saxon.s9api.XdmNode ni)
          generates an XPointer of the form element(/n/m/...) pointing to the node that is the nodeInfo of this fragment This is a very slow function and the use is discouraged except for producing logs when the log is necessary.
 java.lang.String getXPointerShorthandScheme()
          generates an XPointer of the form document-uri#id pointing to the node that is the nodeInfo of this fragment returns null if the element does not have an ID.
 java.lang.String getXPointerToNode(net.sf.saxon.om.NodeInfo node)
          Generates an xpointer syntax that points to this XMLFragment
 int hashCode()
           
 boolean isDead()
          Returns true if the clear method has been called on this object.
 boolean isNamespaceDefined(org.jdom.Namespace ns)
          Checks if the namespace in the parameter is defined in this node
 boolean objEquals(java.lang.Object other)
          Access to the equals method on the Object object in the class hierarchy.
 int objHashCode()
          Access to the hashCode form this object.
static java.lang.String qNameToString(javax.xml.namespace.QName q)
          Creates a string representation of a QName following some rules: If the QName has a prefix, the prefix:localName format is used otherwise only localName is returned
 void removeAttribute(XBRLAttribute attribute)
          Removes an attribute to the set of attributes of this XMLFragment
 void removeChild(int index)
          Removes an XMLFragment from the list of children elements of this resource
 void removeChild(XMLFragment f)
          Removes an XMLFragment from the list of children elements of this resource
 void removeFromRelationship(XBRLRelationship rel)
           
 void removeToRelationship(XBRLRelationship rel)
           
 void removeXMLChild(XMLHasParent child)
           
 void resetElements()
           
 void resetHash()
          Resets the internal value of the cachedHash to null.
 java.net.URI resolveHRef(java.net.URI href)
          Resolves an HRef by returning the absolute URI of the document pointed to by the href.
 java.net.URI resolveHRef(java.net.URI href, net.sf.saxon.s9api.XdmNode objS)
          Resolves an HRef by returning the absolute URI of the document pointed to by the href.
static boolean s_equal2(net.sf.saxon.om.Item node1, net.sf.saxon.om.Item node2, boolean bIncludeIdAttributes)
          Resolves s_equal2 comparison of the two nodes.
 boolean s_equal2(java.lang.Object other)
          Resolves s_equal2 comparison of this node against the other node.
 void setAttributes(java.util.Set<XBRLAttribute> attributeSet)
          Adds or replaces the attributes of this object with attributes in the set received as a parameter to this method.
 void setBase(java.net.URI uri)
          Sets an attribute called xml:base on this node or changes the value of that node if it exists
 void setDocument(net.sf.saxon.s9api.XdmNode doc)
          Changes this object's root node.
 void setDocumentAndReload(net.sf.saxon.s9api.XdmNode doc)
          This method is called by the XMLFragment object each time the surrounding XdmNode object is set.
 void setElements(java.util.Iterator<XMLFragment> elementsIter)
           
 void setId(java.lang.String id)
          Sets the content of the id attribute of this element the ID MUST not have any space, but null is allowed and removes an id from an XML Fragment.
 void setLang(java.lang.String lang)
          Sets the language for this element
 void setNamespaceContext(net.sf.saxon.om.NamespaceResolver ns)
          Replace the namespace context of this XMLDocument by the new one provided as a parameter
 void setNamespaces(java.util.Collection<org.jdom.Namespace> colNamespaces)
          One by one add the namespaces in the collection received as a parameter
 void setNode(org.jdom.Content node)
          Set's this XMLFragment jdomNode to a specific node.
 void setNodeName(javax.xml.namespace.QName nodeName)
          Sets a new nodeName to this XMLFragment
 void setParent(XMLHasParent parent)
          Sets the parent of this node to the specific XMLFragment
 void setValue(net.sf.saxon.value.AtomicValue value)
           
 void setValue(net.sf.saxon.s9api.XdmValue value)
          Sets the value of this node
 void setVariablesDefined(XBRLVariableResolver res)
          Sets the object that will serve as a variable resolver for variables in the scope of this object
 java.lang.String toString()
          Returns the XML representation of this object as an String
 boolean valueEquals(XMLFragment o)
          Returns true if this elements' values is equal to the parameters' element value.
static boolean xEqual(net.sf.saxon.value.AtomicValue param1, net.sf.saxon.value.AtomicValue param2, boolean bXBRLSpecCompliant)
          performs the x-equality comparison of two strings as indicated in the XBRL 2.1 specification
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

XPOINTER

public static final int XPOINTER
Constant used to indicate formatting options for the friendly name of an object

See Also:
getFriendlyName(int, LabelsProvider), Constant Field Values

XPATH

public static final int XPATH
Constant used to indicate formatting options for the friendly name of an object

See Also:
getFriendlyName(int, LabelsProvider), Constant Field Values

NO_POSITION

public static final int NO_POSITION
Constant used to indicate formatting options for the friendly name of an object

See Also:
getFriendlyName(int, LabelsProvider), Constant Field Values

SOURCE_DOCUMENT

public static int SOURCE_DOCUMENT
Constant used to indicate formatting options for the friendly name of an object

See Also:
getFriendlyName(int, LabelsProvider)

CONCEPT_QNAME

public static final int CONCEPT_QNAME
Constant used to indicate formatting options for the friendly name of an object

See Also:
getFriendlyName(int, LabelsProvider), Constant Field Values

CONCEPT_LABEL

public static final int CONCEPT_LABEL
Constant used to indicate formatting options for the friendly name of an object

See Also:
getFriendlyName(int, LabelsProvider), Constant Field Values

FACT_QNAME

public static final int FACT_QNAME
Constant used to indicate formatting options for the friendly name of an object

See Also:
getFriendlyName(int, LabelsProvider), Constant Field Values

FACT_CONCEPT_LABEL

public static final int FACT_CONCEPT_LABEL
Constant used to indicate formatting options for the friendly name of an object

See Also:
getFriendlyName(int, LabelsProvider), Constant Field Values

FACT_CONCEPT_DATATYPE

public static final int FACT_CONCEPT_DATATYPE
Includes the fact data type in the fact friendly name string.

See Also:
getFriendlyName(int, LabelsProvider), Constant Field Values

SHORT_TEXT

public static final int SHORT_TEXT
for resources, this returns the resource text, the id, the xlink:label or the node name in that order

See Also:
Constant Field Values

PERIOD_TYPE

public static final int PERIOD_TYPE
Includes the period type description after the period value

See Also:
getFriendlyName(int, LabelsProvider), Constant Field Values

PERIOD_VALUE

public static final int PERIOD_VALUE
Includes the period value on XBRLPeriod instances

See Also:
getFriendlyName(int, LabelsProvider), Constant Field Values

EMPTYRELATIONSHIPSITERATORINSTANCE

public static final EmptyIterator<XBRLRelationship> EMPTYRELATIONSHIPSITERATORINSTANCE
Implements an empty Iterator over relationships returned when there are no relationships to iterate over


EMPTYXMLFRAGMENTITERATORINSTANCE

public static final EmptyIterator<XMLFragment> EMPTYXMLFRAGMENTITERATORINSTANCE
Implements an empty Iterator over XMLFragments returned when there are no XMLFragments to iterate over


OrderComparator

public static final java.util.Comparator<XBRLRelationship> OrderComparator
class to compare two relationships based on the value of the order attribute and order a set of arcs accordingly


idQName

public static final javax.xml.namespace.QName idQName
This is the name of the attribute id defined here for convenience

the id QName is in the no namespace and has no prefix

Constructor Detail

XMLFragment

public XMLFragment(DTSContainer dts)
Creates a new XMLFragment object in a DTS


XMLFragment

public XMLFragment(XMLFragment other)
Copy constructor for an XMLFragment

Parameters:
other -
Throws:
XBRLValidationException

XMLFragment

public XMLFragment(DTSContainer newDTS,
                   XMLFragment other)
Copy all properties from the other object but sets the DTS to a new one. This constructor is used for copying static objects like static roleType or static arcroleType definitions from the static dts to the new DTS

Parameters:
newDTS -
other -
Throws:
XBRLValidationException
Method Detail

objHashCode

public int objHashCode()
Access to the hashCode form this object.

Returns:
integer

objEquals

public boolean objEquals(java.lang.Object other)
Access to the equals method on the Object object in the class hierarchy.

Parameters:
other - Object
Returns:
boolean

clone

public XMLFragment clone()
Overrides:
clone in class java.lang.Object

clone

public XMLFragment clone(DTSContainer newDTS)

toString

public java.lang.String toString()
Returns the XML representation of this object as an String

Overrides:
toString in class java.lang.Object

getFriendlyName

public java.lang.String getFriendlyName()
Returns a string description that represents the element content in a form that users can understand. This method may be overridden by parent classes.

Remarks, this method may return very long names not suitable for user interface

Returns:
Non empty String. Internationalization is enabled

getFriendlyName

public java.lang.String getFriendlyName(int modifiers,
                                        LabelsProvider lp)
Returns a string description that represents the element content in a form that users can understand. This method may be override by parent classes.

This function accepts flags that are defined as constants in XMLFragment in order to modify the output.

Parameters:
modifiers - integer
Returns:
Non empty String. Internationalization is enabled
Since:
2.6.6

qNameToString

public static java.lang.String qNameToString(javax.xml.namespace.QName q)
Creates a string representation of a QName following some rules: If the QName has a prefix, the prefix:localName format is used otherwise only localName is returned

Parameters:
q -
Returns:
String

setDocument

public final void setDocument(net.sf.saxon.s9api.XdmNode doc)
Changes this object's root node. Updates the internal xpath evaluator, resets the namespaces and updates the xpathToRoot property

Parameters:
doc -

setDocumentAndReload

public void setDocumentAndReload(net.sf.saxon.s9api.XdmNode doc)
                          throws XBRLInconsistentDTSException,
                                 com.rs.lic.LicenseVerificationException
This method is called by the XMLFragment object each time the surrounding XdmNode object is set. This happens internally by the XBRL API after XML Schema validation is performed so the surrounding XML nodes acquire type information.

Overwrite this method in parent objects in order to refresh objects that depends on the surrounding XML nodes.

Parameters:
doc - the new XdmNode
Throws:
XBRLInconsistentDTSException
com.rs.lic.LicenseVerificationException

getXPathToRoot

public 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.

Returns:
String

getContainerDocumentURI

public java.net.URI getContainerDocumentURI()
Try to obtain this document URI.

In case a document URI cannot be obtained the URI "file:///Unkown" is returned.

Returns:
the document URI if it can be obtained from this fragment.

getDocument

public net.sf.saxon.s9api.XdmNode getDocument()
Returns the surrounding XML Node

Returns:
NodeInfo

getContainer

public DTSContainer getContainer()
Returns the DTS Container object

Returns:
DTSContainer

getValue

public net.sf.saxon.s9api.XdmValue getValue()
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

Returns:
a net.sf.saxon.s9api.XdmValue

getQNameValue

public javax.xml.namespace.QName getQNameValue()
Returns this XMLFragment value as a QName If the value is a QName type value the QName is extracted and returned as a QName. If the value is UntypedAtomic and it contains a prefix:localname then the prefix is resolved to the namespace and a QName is returned.

Returns:
a javax.xml.namespace.QName QName
Throws:
org.jdom.IllegalNameException - (RuntimeException) if the value is an illegal QName

getBooleanValue

public boolean getBooleanValue()
If the value is a Boolean type value then Boolean value is extracted and returned as a boolean.

Returns:
boolean

getStringValue

public java.lang.String getStringValue()
                                throws XBRLSerializationException
Returns a string representation of the value of this XMLFragment if value is null the function returns null

Returns:
String
Throws:
XBRLSerializationException

setValue

public void setValue(net.sf.saxon.s9api.XdmValue value)
Sets the value of this node

Parameters:
value -
Throws:
org.jdom.IllegalNameException - (RuntimeException) if value is a QName and the prefix and uri forms an illegal namespace name

setValue

public void setValue(net.sf.saxon.value.AtomicValue value)

getNodeName

public javax.xml.namespace.QName getNodeName()
Returns this node's name as a QName. The node name is also the value of the [Type] property on several objects in the infoset like [Linkbase type] [relationship type]


setNodeName

public void setNodeName(javax.xml.namespace.QName nodeName)
Sets a new nodeName to this XMLFragment

Parameters:
nodeName -

getId

public java.lang.String getId()
Access to the element's id. This is not part of the infoset

Returns:
the content of the id attribute or null if there is no id attribute

setId

public void setId(java.lang.String id)
           throws XBRLInconsistentDTSException
Sets the content of the id attribute of this element the ID MUST not have any space, but null is allowed and removes an id from an XML Fragment. This method may be overwritten by other classes that require storing an indexed table of elements and IDs in order to prevent duplicate IDs to exist

Parameters:
id - the new ID
Throws:
XBRLInconsistentDTSException - if the id is not lexicographically valid

getOrGenerateId

public java.lang.String getOrGenerateId()
Obtain the id for this XMLFragment. if not set then this method will create one unique ID and will set it as the ID for this XMLFragment. IDs will be serialized later.

Returns:
String

generateId

public static java.lang.String generateId()
Generates a new unique ID that can be used during the serialization of objects

Returns:
String

resolveHRef

public java.net.URI resolveHRef(java.net.URI href)
Resolves an HRef by returning the absolute URI of the document pointed to by the href. fragments are returned without changes

Parameters:
href - the href attribute content
Returns:
URI

resolveHRef

public java.net.URI resolveHRef(java.net.URI href,
                                net.sf.saxon.s9api.XdmNode objS)
Resolves an HRef by returning the absolute URI of the document pointed to by the href. fragments are returned without changes

Parameters:
href - the href attribute content
objS - the element with the base-uri
Returns:
URI

getFragment

public java.lang.String getFragment(java.lang.String href)
Returns the fragment part of an href.

Parameters:
href -
Returns:
String

setNamespaceContext

public void setNamespaceContext(net.sf.saxon.om.NamespaceResolver ns)
Replace the namespace context of this XMLDocument by the new one provided as a parameter

Parameters:
ns - The new namespace context to use in XPath evaluations

getXPathNamespaceContext

public net.sf.saxon.om.NamespaceResolver getXPathNamespaceContext()
Access to the NamespaceResolver attached to this XMLFragment

Returns:
NamespaceResolver object

evaluateList

public net.sf.saxon.s9api.XdmValue evaluateList(java.lang.String strXPath)
Evaluates an XPath 2.0 expression using this node as the evaluation context. Returns a List of nodes or strings or whatever other data type

Parameters:
strXPath -
Returns:
XdmValue which is a sequence of nodes and/or atomic values
Throws:
java.lang.RuntimeException - encapsulating any SaxonApiException produced during XPath evaluation.

evaluateString

public java.lang.String evaluateString(java.lang.String strXPath)
Evaluates an XPath 2.0 expression using this node as the evaluation conetxt. Returns an String

Parameters:
strXPath -
Returns:
String

evaluateNode

public net.sf.saxon.s9api.XdmItem evaluateNode(java.lang.String strXPath)
Evaluates an XPath 2.0 expression using this node as the evaluation conetxt. Returns a single Node

Parameters:
strXPath -
Returns:
NodeInfo

evaluateBoolean

public java.lang.Boolean evaluateBoolean(java.lang.String strXPath)
Evaluates an XPath 2.0 expression using this node as the evaluation conetxt. Returns a Boolean object

Parameters:
strXPath -
Returns:
Boolean

evaluateNumber

public java.lang.Double evaluateNumber(java.lang.String strXPath)
Evaluates an XPath 2.0 expression using this node as the evaluation context. Returns a Number

Parameters:
strXPath -
Returns:
Double

getAttributeValue

public net.sf.saxon.value.AtomicValue getAttributeValue(javax.xml.namespace.QName attributeName)
Returns a Value object with the value of the attribute on this node. null if the node does not have this attribute

Parameters:
attributeName - Attribute QName
Returns:
Value

getAttributeQNameValue

public javax.xml.namespace.QName getAttributeQNameValue(javax.xml.namespace.QName attributeName)
Returns a Value object with the value of the attribute on this node. null if the node does not have this attribute

Parameters:
attributeName - Attribute QName
Returns:
Value

getAttributeStringValue

public java.lang.String getAttributeStringValue(javax.xml.namespace.QName attributeName)
Returns a String with the value of the attribute on this node. null if the node does not have this attribute.

Unless the getStringValue() method on XMLFragment, this method does not raise an XBRLSerializationException when the value cannot be obtained. If that exception is produced it is encapsulated inside an XBRLRuntimeException instead.

Parameters:
attributeName - Attribute QName
Returns:
String
Throws:
XBRLRuntimeException - encapsulating an XBRLSerializationException (very rare)
Since:
2.7.2

getAttribute

public XBRLAttribute getAttribute(javax.xml.namespace.QName attributeName)
Obtains an XBRLAttribute object that is defined in this XMLFragment or null if not found

Parameters:
attributeName -
Returns:
XBRLAttribute

getNamespaceURI

public java.lang.String getNamespaceURI(java.lang.String prefix)
Returns the namespace URI for the specified prefix as defined in this node

Specified by:
getNamespaceURI in interface javax.xml.namespace.NamespaceContext

getPrefix

public java.lang.String getPrefix(java.lang.String namespaceURI)
Returns the prefix String associated to the given URI as defined in this node

Specified by:
getPrefix in interface javax.xml.namespace.NamespaceContext

addNamespace

public void addNamespace(java.lang.String prefix,
                         java.lang.String uri)
Adds a new namespace and prefix to this object's namespace context. Prefixes and namespaces added are evailable for the evaluation of XPath 2.0 expressions

Parameters:
prefix -
uri -
Throws:
org.jdom.IllegalNameException - (RuntimeException) if the prefix and uri forms an illegal namespace name

getPrefixes

public java.util.Iterator<?> getPrefixes(java.lang.String namespaceURI)
Specified by:
getPrefixes in interface javax.xml.namespace.NamespaceContext

getBaseURI

public java.lang.String getBaseURI()
Returns:
the XML Infoset property [Base URI] of this XML Fragment

getXPointerToNode

public java.lang.String getXPointerToNode(net.sf.saxon.om.NodeInfo node)
Generates an xpointer syntax that points to this XMLFragment

Parameters:
node -
Returns:
String

getXPointerElementScheme

public java.lang.String getXPointerElementScheme()
generates an XPointer of the form element(/n/m/...) pointing to the node that is the nodeInfo of this fragment

Returns:
String

getXPointerElementScheme

public static java.lang.String getXPointerElementScheme(net.sf.saxon.s9api.XdmNode ni)
generates an XPointer of the form element(/n/m/...) pointing to the node that is the nodeInfo of this fragment This is a very slow function and the use is discouraged except for producing logs when the log is necessary.

Returns:
String

getXPointerShorthandScheme

public java.lang.String getXPointerShorthandScheme()
generates an XPointer of the form document-uri#id pointing to the node that is the nodeInfo of this fragment returns null if the element does not have an ID. Use an element scheme XPointer instead

Returns:
String

generatePrefix

public static java.lang.String generatePrefix(java.lang.String namespace)
Returns a prefix that is created automatically and bounds it to the namespace

Parameters:
namespace -
Returns:
String

getStaticNamespace

public static java.lang.String getStaticNamespace(java.lang.String prefix)
Returns the namespace URI for a prefix. This methos search only the static defined namespaces and prefixes

Parameters:
prefix - String
Returns:
String

getXPathToNode

public java.lang.String getXPathToNode(net.sf.saxon.om.NodeInfo node)
Builds an XPath2 expression that points to the node received as a parameter.

Parameters:
node -
Returns:
String

setVariablesDefined

public void setVariablesDefined(XBRLVariableResolver res)
Sets the object that will serve as a variable resolver for variables in the scope of this object

Parameters:
res - XBRLVariableResolver

equals

public boolean equals(java.lang.Object other)
Sets a new XPathFunctionResolver for this object

Overrides:
equals in class java.lang.Object

valueEquals

public boolean valueEquals(XMLFragment o)
Returns true if this elements' values is equal to the parameters' element value.

Parameters:
o -
Returns:
boolean

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

resetHash

public void resetHash()
Resets the internal value of the cachedHash to null. The next call to hashCode will generate the cachedHash valua again.

This method is called when the elements to create the hashCode for an XMLFragment has been changed and the old hashCode is no longer valid and must be calculated again.

Sometimes it is not desired to change the old hashValue if the document is persistent and the changes we are made are just temporary.

use with care.


s_equal2

public boolean s_equal2(java.lang.Object other)
Resolves s_equal2 comparison of this node against the other node.

Parameters:
other - The other node (preferably an XMLFragment) that contains a non null NodeInfo document.
Returns:
boolean

s_equal2

public static boolean s_equal2(net.sf.saxon.om.Item node1,
                               net.sf.saxon.om.Item node2,
                               boolean bIncludeIdAttributes)
Resolves s_equal2 comparison of the two nodes.

Parameters:
node1 - Item
node2 - Item
bIncludeIdAttributes - boolean when nodes are elements, if the elements have id attributes, they may or may not be skiped.
Returns:
boolean

getFromRelationships

public java.util.Iterator<XBRLRelationship> getFromRelationships(XBRLArcroleType arcrole,
                                                                 DTSBase base)
Returns the relationship objects that contains this element in the source of the relationship using a filter on the arcrole value

Specified by:
getFromRelationships in interface XBRLRelationshipPoint

getFromRelationships

public java.util.Collection<XBRLRelationship> getFromRelationships(XBRLArcroleType arcrole,
                                                                   DTSBase base,
                                                                   java.util.Comparator<XBRLRelationship> comparator)
Returns a collection of relationship objects that contains this element in the source of the relationship using a filter on the arcrole value and that belongs to a specific base. The result is ordered using the comparator object passed in as a parameter.

Parameters:
arcrole - the arcrole to filter
base - the role to filter
comparator - the compataror to order relationships
Returns:
Collection of XBRLRelationship
Since:
2.7.2

getToRelationships

public java.util.Collection<XBRLRelationship> getToRelationships(XBRLArcroleType arcrole,
                                                                 DTSBase base,
                                                                 java.util.Comparator<XBRLRelationship> comparator)
Returns a collection of relationship objects that contains this element in the target of the relationship using a filter on the arcrole value and that belongs to a specific base. The result is ordered using the comparator object passed in as a parameter.

Parameters:
arcrole - the arcrole to filter
base - the role to filter
comparator - the compataror to order relationships
Returns:
Collection of XBRLRelationship
Since:
2.7.2

getFromRelationships

public java.util.Iterator<XBRLRelationship> getFromRelationships(XBRLArcroleType arcrole)
Obtains an iterator over all relationships where this fragment is the source of the relationship and the arcrole corresponds to the parameter indicated.

Parameters:
arcrole - XBRLArcroleType
Returns:
Iterator<XBRLRelationship>
Since:
2.6.5

getToRelationships

public java.util.Iterator<XBRLRelationship> getToRelationships(XBRLArcroleType arcrole)
Obtains an iterator over all relationships where this fragment is the target of the relationship and the arcrole corresponds to the parameter indicated.

Parameters:
arcrole - XBRLArcroleType
Returns:
Iterator<XBRLRelationship>
Since:
2.6.5

getFromRelationships

public java.util.Iterator<XBRLRelationship> getFromRelationships()
Returns the relationship objects that contains this element in the source of the relationship

Returns:
Iterator

getNumberOfFromRelationships

public int getNumberOfFromRelationships()
                                 throws XBRLValidationException
Returns the number of relationships this fragment is in its source

Returns:
int
Throws:
XBRLValidationException

getToRelationships

public java.util.Iterator<XBRLRelationship> getToRelationships(XBRLArcroleType arcrole,
                                                               DTSBase base)
Returns the relationship objects that contains this element in the target of the relationship or null if there is none

Specified by:
getToRelationships in interface XBRLRelationshipPoint

getToRelationships

public java.util.Iterator<XBRLRelationship> getToRelationships()
Returns the relationship objects that contains this element in the target of the relationship

Throws:
XBRLValidationException

getNumberOfToRelationships

public int getNumberOfToRelationships()
                               throws XBRLValidationException
Returns the number of relationships this fragment is in its target

Throws:
XBRLValidationException

addFromRelationship

public void addFromRelationship(XBRLRelationship rel)
                         throws XBRLInconsistentDTSException
Specified by:
addFromRelationship in interface XBRLRelationshipPoint
Throws:
XBRLInconsistentDTSException

addToRelationship

public void addToRelationship(XBRLRelationship rel)
                       throws XBRLInconsistentDTSException
Specified by:
addToRelationship in interface XBRLRelationshipPoint
Throws:
XBRLInconsistentDTSException

removeFromRelationship

public void removeFromRelationship(XBRLRelationship rel)
                            throws XBRLInconsistentDTSException
Specified by:
removeFromRelationship in interface XBRLRelationshipPoint
Throws:
XBRLInconsistentDTSException

removeToRelationship

public void removeToRelationship(XBRLRelationship rel)
                          throws XBRLInconsistentDTSException
Specified by:
removeToRelationship in interface XBRLRelationshipPoint
Throws:
XBRLInconsistentDTSException

changeBase

public void changeBase(DTSBase oldBase,
                       DTSBase newBase)
This object is informed that a DTSBase is going to be deleted. All references to it must be cleared. DTSBase is used as index in some hashtables.

Parameters:
oldBase - DTSBase cannot be null
newBase - DTSBase can be null

getRelationshipsBases

public java.util.Iterator<DTSBase> getRelationshipsBases()
                                                  throws XBRLValidationException
Returns an iterator over all DTSBases this object has relationships from

Throws:
XBRLValidationException

getRelationshipTypes

public java.util.Iterator<javax.xml.namespace.QName> getRelationshipTypes(DTSBase base)
                                                                   throws XBRLValidationException
Returns an iterator over all QNames of relationship types that exists in a specific base

Parameters:
base -
Returns:
Iterator
Throws:
XBRLValidationException

getRelationshipsChain

public java.util.Iterator<XBRLRelationshipsChainLink> getRelationshipsChain(DTSBase base,
                                                                            javax.xml.namespace.QName type)
Process all relationships this item is source and returns an iterator over all XBRLRelationshipsChainLink(s)

Returns:
Iterator
Throws:
XBRLValidationException

getLang

public java.lang.String getLang()
Returns the value of the xml:lang attribute on this node or on a parent node Returns null if not specified on this or any parent node

Returns:
String

getBase

public java.net.URI getBase(java.net.URI base)
Search for an attribute called xml:base on this node if set, then resolves the base URI against that attribute and returns the resulting URI

Parameters:
base -
Returns:
URI

getBase

public java.net.URI getBase()
Search for an attribute called xml:base on this node and returns the resulting URI

Specified by:
getBase in interface XMLHasParent
Parameters:
base -
Returns:
URI

setBase

public void setBase(java.net.URI uri)
Sets an attribute called xml:base on this node or changes the value of that node if it exists

Parameters:
uri - as URI

setLang

public void setLang(java.lang.String lang)
Sets the language for this element

Parameters:
lang -

checkBase

public static void checkBase(boolean relativize,
                             java.net.URI base)
                      throws XBRLSerializationException
For internal use only. During the serialization of XBRL elements, if serialization is set to true, then the base MUST not be null and MUST be an absolute URI. In case of errors this method raises an XBRLSerializationException. The code has been placed here because is accesible from multiple other objects in the API.

Parameters:
relativize -
base -
Throws:
XBRLSerializationException
Since:
2.6.5

generateNode

public org.jdom.Content generateNode(boolean relativize,
                                     java.net.URI base)
                              throws XBRLSerializationException
Serializes to a jdom Element the representation of the properties of this Information Item This method should be called from classes derived from this class

Parameters:
relativize - boolean indicating if URIs should be relativized to the base URI (see next argument)
base - the URI to which some attributes of this object should be relativided
Returns:
a clone of the surrounding jdom Element so it can be incorporated into multiple trees
Throws:
XBRLSerializationException

setNode

public void setNode(org.jdom.Content node)
Set's this XMLFragment jdomNode to a specific node. This will overide any value on this object. getValue() will return null

Parameters:
node -

addAttribute

public void addAttribute(XBRLAttribute value)
Adds a new attribute to the set of attributes for this XMLFragment

Parameters:
value - the new attribute to be added to this XMLFragment

delAttribute

public void delAttribute(javax.xml.namespace.QName attributeQName)
Removes an attribute from the attributes defined for this XMLFragment

Parameters:
attributeQName - QName of the attribute to remove
Since:
2.6.4

delAttribute

public void delAttribute(XBRLAttribute attribute)

setAttributes

public void setAttributes(java.util.Set<XBRLAttribute> attributeSet)
Adds or replaces the attributes of this object with attributes in the set received as a parameter to this method.

Parameters:
attributeSet - set of attributes to add or set to this object

removeAttribute

public void removeAttribute(XBRLAttribute attribute)
Removes an attribute to the set of attributes of this XMLFragment

Parameters:
attribute -

getAttributes

public static XBRLAttribute[] getAttributes(DTSContainer dts,
                                            net.sf.saxon.s9api.XdmNode node)
Returns an array of attributes in the node supplied as a parameter

Parameters:
dts - DTSContainer
node - XdmNode that contains attributes
Returns:
Array of XBRLAttribute objects

getAttributes

public java.util.Iterator<XBRLAttribute> getAttributes()
Access to attributes defined in this node.

The id attribute is skiped as there is a specific method to access to it and set a value.

Returns:
Iterator<XBRLAttribute>

addNamespace

public void addNamespace(org.jdom.Namespace ns)
Adds a namespace declaration that will be in the scope of namespaces declared in this node. Namespace declarations will be serialized to final output.

Parameters:
ns - Namespace

setNamespaces

public void setNamespaces(java.util.Collection<org.jdom.Namespace> colNamespaces)
One by one add the namespaces in the collection received as a parameter

Parameters:
colNamespaces - a Collection<Namespace> type

getDeclaredNamespaces

public java.util.Iterator<org.jdom.Namespace> getDeclaredNamespaces()
Access to the set of declared namespaces in this node.

Note, declared namespaces are those phisically declared, not the set of in-scope namespaces declared on parent nodes of this node.

Returns:
Iterator<Namespace>

isNamespaceDefined

public boolean isNamespaceDefined(org.jdom.Namespace ns)
Checks if the namespace in the parameter is defined in this node

Parameters:
ns - Namespace to check if it is in scope
Returns:
boolean

getNumberOfElements

public int getNumberOfElements()
If this node has child nodes this method returns how many nodes are there.

Returns:
integer

getChild

public XMLFragment getChild(int index)
Direct access to the nth child node from this node as parent.

Parameters:
index - integer, 0 based
Returns:
XMLFragment representing the nth child
Throws:
IndexArrayOutOfBoundsException - if the element does not have a child at the indicated index
Since:
2.6.9

getElements

public java.util.Iterator<XMLFragment> getElements()
For complex type resources this returns an iterator with all children XML fragments Tthis method may be overwriten by other classes in the hierarchy

Returns:
Iterator

setElements

public void setElements(java.util.Iterator<XMLFragment> elementsIter)
Parameters:
elementsIter - Iterator

addChild

public void addChild(XMLFragment f)
Sets the resource value to a comples type value and adds a fragment to it

Parameters:
f -

resetElements

public void resetElements()

removeChild

public void removeChild(int index)
Removes an XMLFragment from the list of children elements of this resource

Parameters:
index -

removeChild

public void removeChild(XMLFragment f)
Removes an XMLFragment from the list of children elements of this resource

Parameters:
f -

generateNodeNamespacesAndAttributes

public void generateNodeNamespacesAndAttributes(org.jdom.Content jdomNode)
                                         throws XBRLInconsistentDTSException
Adds namespaces and attributes in this node to the Content node supplied as a parameter

Parameters:
jdomNode - org.jom.Content node
Throws:
XBRLValidationException - in very rare cases (if this node has relationships and an id is not defined and a new id cannot be generated on this node)
XBRLInconsistentDTSException

generateNodeValue

public void generateNodeValue(org.jdom.Element jdomNode)
                       throws XBRLSerializationException
Throws:
XBRLSerializationException

xEqual

public static boolean xEqual(net.sf.saxon.value.AtomicValue param1,
                             net.sf.saxon.value.AtomicValue param2,
                             boolean bXBRLSpecCompliant)
performs the x-equality comparison of two strings as indicated in the XBRL 2.1 specification

Parameters:
param1 -
param2 -
bXBRLSpecCompliant - The functions specification requires this parameter to be set to false because the comformance suite of the functions specification IS NOT XBRL 2.1 compliant. If this value is set to false, strings are trim() before comparison. if this parameter is set to true this value obtained as it appears in the XML node (as indicated in secion 4.10 of the XBRL 2.1 specification).
Returns:
Since:
2.7.0

setParent

public void setParent(XMLHasParent parent)
               throws XBRLInconsistentDTSException
Sets the parent of this node to the specific XMLFragment

Specified by:
setParent in interface XMLHasParent
Parameters:
parent -
Throws:
XBRLInconsistentDTSException

addXMLChild

public void addXMLChild(XMLHasParent newChild)
                 throws XBRLInconsistentDTSException
Specified by:
addXMLChild in interface XMLHasParent
Throws:
XBRLInconsistentDTSException

removeXMLChild

public void removeXMLChild(XMLHasParent child)
Specified by:
removeXMLChild in interface XMLHasParent

getParent

public XMLHasParent getParent()
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 XMLHasParent
Returns:
the parent XMLFragment possible parents are: XBRLItem, XBRLTuple, XBRLImport, XBRLLinkbase, XBRLExtendedLink, XBRLDocumentation, XBRLRelationship, XBRLResource.

clear

public void clear()
           throws java.lang.Throwable
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.

Throws:
java.lang.Throwable

isDead

public boolean isDead()
Returns true if the clear method has been called on this object. This method can be used to detect if an object contains valid references to other objects or if all references are no longer valid.

Returns:
boolean value, 'true' if the object may contain invalid references to other objects

equalXdmValues

public static boolean equalXdmValues(net.sf.saxon.s9api.XdmValue val,
                                     net.sf.saxon.s9api.XdmValue val2)
Compares two XdmValue objects and return true if both are the same atomicValues or the same XML nodes. This method uses #s_equal2(Item, Item, true) to compare nodes and s_equal2(ValueRepresentation, ValueRepresentation) for comparing values.

Parameters:
val - XdmValue
val2 - XdmValue
Returns:
boolean


Copyright 2006-2009 Reporting Standard S.L., C/ Torrecilla del Puerto 1, 28043, Madrid, Espaņa