XBRLAPI

A Java API for XBRL


org.xbrlapi
Interface XML

All Superinterfaces:
Comparable<XML>, Serializable
All Known Subinterfaces:
Arc, ArcEnd, ArcroleType, AspectValueLabel, AspectValuePair, AttributeDeclaration, AttributeGroupDeclaration, ComplexTypeDeclaration, Concept, Context, ContextComponent, CustomType, Dimension, ElementDeclaration, Entity, EntityResource, Error, ExplicitDimension, ExtendedLink, ExtendedLinkContent, Fact, FactDimensionContainer, FootnoteResource, FractionItem, Fragment, Hypercube, Instance, Item, LabelResource, Language, Link, Linkbase, Locator, Match, MeasureResource, MixedContentResource, Mock, NetworkGraph, NonFragmentXML, NonNumericItem, NumericItem, OpenContextComponent, Period, ReferencePart, ReferencePartDeclaration, ReferenceResource, Relationship, Resource, RoleType, Scenario, Schema, SchemaAllCompositor, SchemaChoiceCompositor, SchemaCompositor, SchemaContent, SchemaContentDeclaration, SchemaDeclaration, SchemaGroupCompositor, SchemaSequenceCompositor, Segment, SimpleLink, SimpleNumericItem, SimpleTypeDeclaration, Stub, Title, Tuple, TypedDimension, TypeDeclaration, Unit, UsedOn, XDTConcept, Xlink, XlinkDocumentation
All Known Implementing Classes:
ArcEndImpl, ArcImpl, ArcroleTypeImpl, AspectValueLabelImpl, AspectValuePairImpl, AttributeDeclarationImpl, AttributeGroupDeclarationImpl, ComplexTypeDeclarationImpl, ConceptImpl, ContextComponentImpl, ContextImpl, CustomTypeImpl, DimensionImpl, ElementDeclarationImpl, EntityImpl, EntityResourceImpl, ErrorImpl, ExplicitDimensionImpl, ExtendedLinkContentImpl, ExtendedLinkImpl, FactDimensionContainerImpl, FactImpl, FootnoteResourceImpl, FractionItemImpl, FragmentImpl, HypercubeImpl, InstanceImpl, ItemImpl, LabelResourceImpl, LanguageImpl, LinkbaseImpl, LinkImpl, LocatorImpl, MatchImpl, MeasureResourceImpl, MixedContentResourceImpl, MockImpl, NetworkGraphImpl, NonFragmentXMLImpl, NonNumericItemImpl, NumericItemImpl, OpenContextComponentImpl, PeriodImpl, ReferencePartDeclarationImpl, ReferencePartImpl, ReferenceResourceImpl, RelationshipImpl, ResourceImpl, RoleTypeImpl, ScenarioImpl, SchemaAllCompositorImpl, SchemaChoiceCompositorImpl, SchemaCompositorImpl, SchemaContentDeclarationImpl, SchemaContentImpl, SchemaDeclarationImpl, SchemaGroupCompositorImpl, SchemaImpl, SchemaSequenceCompositorImpl, SegmentImpl, SimpleLinkImpl, SimpleNumericItemImpl, SimpleTypeDeclarationImpl, StubImpl, TitleImpl, TupleImpl, TypedDimensionImpl, TypeDeclarationImpl, UnitImpl, UsedOnImpl, XDTConceptImpl, XlinkDocumentationImpl, XMLImpl

public interface XML
extends Comparable<XML>, Serializable


Method Summary
 void appendMetadataElement(String eName, Map<String,String> attributes)
          Appends a child element to the root metadata element.
 boolean equals(Object o1)
          Override the Object equals method to base equality on the fragment index.
 Builder getBuilder()
          Get the fragment builder.
 Document getDocumentNode()
          Get the XML DOM Document for the fragment data.
 String getIndex()
          Get the index of the XML resource.
 String getMetaAttribute(String name)
          Get a fragment metadata attribute.
 Element getMetadataRootElement()
          Get the root element of the fragment metadata.
 Store getStore()
          Get the data store that manages this fragment.
 String getType()
          Get the Fragment type.
 int hashCode()
          Override the Object hashCode method to provide for equality comparisons that are based on the fragment index.
 boolean hasMetaAttribute(String name)
           
 boolean isa(Class<?> targetClass)
           
 boolean isa(String superType)
           
 void removeMetaAttribute(String name)
          Removes a metadata attribute
 void removeMetadataElement(String eName, HashMap<String,String> attributes)
          removes a child element from the metadata root element by specifying the name of the child and the value of the element's text content and/or the value of a named attribute.
 String serialize()
           
 void serialize(File file)
          Serializes the XML to the specified file.
 void serialize(OutputStream outputStream)
          Serializes the XML to the specified output stream.
 void setBuilder(Builder builder)
          Set the builder that constructs the fragment XML during parsing.
 void setIndex(String index)
          Set the fragment index.
 void setMetaAttribute(String name, String value)
          Set a fragment metadata attribute.
 void setResource(Element rootElement)
          Closes down the fragment builder and sets the data and metadata resources for the fragment.
 void setStore(Store store)
          Set the data store that manages this fragment.
 void updateInStore()
          Updates the data store to reflect the current state of this XML object.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

hashCode

int hashCode()
Override the Object hashCode method to provide for equality comparisons that are based on the fragment index.

Overrides:
hashCode in class Object

equals

boolean equals(Object o1)
               throws ClassCastException
Override the Object equals method to base equality on the fragment index.

Overrides:
equals in class Object
Throws:
ClassCastException - if the object that the fragment being compared to does not cast to a fragment.

isa

boolean isa(String superType)
            throws XBRLException
Parameters:
superType - The specified fragment type to test against.
Returns:
true if the fragment is an extension of the specified fragment type.
Throws:
XBRLException
See Also:
isa(Class)

isa

boolean isa(Class<?> targetClass)
            throws XBRLException
Parameters:
targetClass - The specified XML resource subclass to test against.
Returns:
true if the fragment is an extension of the specified fragment type.
Throws:
XBRLException

setResource

void setResource(Element rootElement)
                 throws XBRLException
Closes down the fragment builder and sets the data and metadata resources for the fragment. This should only be used by Store implementations at the point where a newly built fragment is stored.

Parameters:
rootElement - The fragment data.
Throws:
XBRLException - If the builder cannot be shut down or if the resource cannot be set or is null.

getDocumentNode

Document getDocumentNode()
Get the XML DOM Document for the fragment data.

Returns:
an XML DOM document for the fragment or null if none exists.

getMetadataRootElement

Element getMetadataRootElement()
Get the root element of the fragment metadata.

Returns:
an XML Element that is the root of the fragment metadata.

setStore

void setStore(Store store)
              throws XBRLException
Set the data store that manages this fragment.

Parameters:
store - The data store.
Throws:
XBRLException - if the data store has already been set.

setBuilder

void setBuilder(Builder builder)
                throws XBRLException
Set the builder that constructs the fragment XML during parsing.

Parameters:
builder - The builder object used to construct the fragment XML.
Throws:
XBRLException - if the builder cannot be set or is null.

getStore

Store getStore()
Get the data store that manages this fragment.

Returns:
the data store that manages this fragment or null if the fragment has not been stored.

getBuilder

Builder getBuilder()
Get the fragment builder. Note that the builder is null if the fragment has already been stored in a data store. TODO Should fragments hide the builder property?

Returns:
the fragment builder or null if one is not available.

getType

String getType()
Get the Fragment type. The fragment type is immutable. No public method is available to set the fragment type.

Returns:
The full class name of the fragment.

getIndex

String getIndex()
Get the index of the XML resource. This is the name used for the XML resource in the data store.


setIndex

void setIndex(String index)
              throws XBRLException
Set the fragment index. Note that no checks are performed to ensure that the fragment index is unique within the data store. This method instantiates a fragment builder for fragments that do not have a resource property.

Throws:
an - XBRLException if the index is null or an empty string.
XBRLException

setMetaAttribute

void setMetaAttribute(String name,
                      String value)
                      throws XBRLException
Set a fragment metadata attribute.

Parameters:
name - the name of the attribute
value - the value to give to the metadata attribute
Throws:
XBRLException

getMetaAttribute

String getMetaAttribute(String name)
Get a fragment metadata attribute.

Parameters:
name - the name of the attribute.
Returns:
The value of the metadata attribute or null if none exists.

hasMetaAttribute

boolean hasMetaAttribute(String name)
Parameters:
name - the name of the attribute.
Returns:
true if the XML resource has a metadata attribute with the specfied name.

removeMetaAttribute

void removeMetaAttribute(String name)
                         throws XBRLException
Removes a metadata attribute

Parameters:
name - The name of the attribute to remove
Throws:
XBRLException

appendMetadataElement

void appendMetadataElement(String eName,
                           Map<String,String> attributes)
                           throws XBRLException
Appends a child element to the root metadata element.

Parameters:
eName - Name of the element to be added (no namespaces are used).
attributes - A map from attribute name keys to attribute values.
Throws:
XBRLException.
XBRLException

removeMetadataElement

void removeMetadataElement(String eName,
                           HashMap<String,String> attributes)
                           throws XBRLException
removes a child element from the metadata root element by specifying the name of the child and the value of the element's text content and/or the value of a named attribute. All specified information must match for the deletion to succeed.

Parameters:
eName - Name of the element to be added (no namespaces are used).
attributes - A hashmap from attribute name keys to attribute values.
Throws:
XBRLException - If no deletion happens.

serialize

void serialize(File file)
               throws XBRLException
Serializes the XML to the specified file.

Parameters:
file - The specified output file.
Throws:
XBRLException

serialize

void serialize(OutputStream outputStream)
               throws XBRLException
Serializes the XML to the specified output stream.

Parameters:
outputStream - The specified output stream.
Throws:
XBRLException

serialize

String serialize()
                 throws XBRLException
Returns:
the XML as a string.
Throws:
XBRLException

updateInStore

void updateInStore()
                   throws XBRLException
Updates the data store to reflect the current state of this XML object. If the XML object has not yet been stored then no action is taken. If there is a XML resource in the store with the same index, then that earlier version is first deleted from the data store.

Throws:
XBRLException

Get Java XBRL API implementation at SourceForge.net.