XBRLAPI

A Java API for XBRL


org.xbrlapi.sax.identifiers
Class BaseIdentifier

java.lang.Object
  extended by org.xbrlapi.sax.identifiers.BaseIdentifier
All Implemented Interfaces:
Identifier
Direct Known Subclasses:
GenericDocumentRootIdentifier, LanguageIdentifier, ReferencePartIdentifier, SchemaIdentifier, XBRLIdentifier, XBRLXLinkIdentifier

public class BaseIdentifier
extends Object
implements Identifier

The class implements the common methods for a fragment identifier. This fragment identifier will never identify a fragment. Customised fragment identifiers should extend this base class to inherit the implementations of the common methods.

Author:
Geoffrey Shuetrim (geoff@galexy.net)

Field Summary
protected static org.apache.log4j.Logger logger
           
 
Constructor Summary
BaseIdentifier(ContentHandler contentHandler)
           
 
Method Summary
 void endElement(String namespaceURI, String lName, String qName, Attributes attrs)
          Updates the state of the fragment identifier when the end of an element is parsed.
 ContentHandler getContentHandler()
           
 ElementState getElementState()
           
 Loader getLoader()
           
 void processFragment(Fragment fragment, Attributes attrs)
          Performs the following operations on the fragment: Sets its fragment index Determines if the fragment as an ID attribute and if so, appends an ID ( @see org.xbrlapi.Fragment#appendID(String) ) and sets the ID in the element state. Adds the fragment ( @see org.xbrlapi.loader.Loader#add(org.xbrlapi.Fragment,org.xbrlapi.xlink.ElementState) ) Override this base implementation if an ID of the fragment root element can be expressed by an attribute other than "id".
 void setContentHandler(ContentHandler contentHandler)
           
 void startElement(String namespaceURI, String lName, String qName, Attributes attrs)
          Determines if the element starts a new fragment and if so: creates the fragment sets the fragment index stores any ID attributes on the fragment root in the fragment metadata and in the element state object adds the fragment to the loader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static org.apache.log4j.Logger logger
Constructor Detail

BaseIdentifier

public BaseIdentifier(ContentHandler contentHandler)
               throws XBRLException
Parameters:
contentHandler - The content handler using this fragment identifier.
Throws:
XBRLException - if the XLink processor is null.
Method Detail

getContentHandler

public ContentHandler getContentHandler()
Specified by:
getContentHandler in interface Identifier
Returns:
the SAX content handler using the fragment identifier.
See Also:
Identifier.getContentHandler()

setContentHandler

public void setContentHandler(ContentHandler contentHandler)
                       throws XBRLException
Specified by:
setContentHandler in interface Identifier
Parameters:
contentHandler - The content handler using the fragment identifier.
Throws:
XBRLException - if the content handler is null.
See Also:
Identifier.setContentHandler(ContentHandler)

getLoader

public Loader getLoader()
Specified by:
getLoader in interface Identifier
Returns:
the loader that is using the content handler that uses this fragment identifier.
See Also:
Identifier.getLoader()

getElementState

public ElementState getElementState()
Specified by:
getElementState in interface Identifier
Returns:
the element state for the element currently being parsed.
See Also:
Identifier.getElementState()

startElement

public void startElement(String namespaceURI,
                         String lName,
                         String qName,
                         Attributes attrs)
                  throws XBRLException
Description copied from interface: Identifier
Determines if the element starts a new fragment and if so:

Specified by:
startElement in interface Identifier
Parameters:
namespaceURI - the namespace of the element
lName - the local name of the element
qName - the qname of the element
attrs - the attributes of the element
Throws:
XBRLException
See Also:
Identifier.startElement(String, String, String, Attributes)

endElement

public void endElement(String namespaceURI,
                       String lName,
                       String qName,
                       Attributes attrs)
                throws XBRLException
Description copied from interface: Identifier
Updates the state of the fragment identifier when the end of an element is parsed.

Specified by:
endElement in interface Identifier
Parameters:
namespaceURI - the namespace of the element
lName - the local name of the element
qName - the qname of the element
attrs - the attributes of the element
Throws:
XBRLException
See Also:
Identifier.endElement(String, String, String, Attributes)

processFragment

public void processFragment(Fragment fragment,
                            Attributes attrs)
                     throws XBRLException
Performs the following operations on the fragment: Override this base implementation if an ID of the fragment root element can be expressed by an attribute other than "id".

Specified by:
processFragment in interface Identifier
Parameters:
fragment - The fragment that has been identified.
attrs - The attributes of the root element of the fragment.
Throws:
XBRLException
See Also:
Identifier.processFragment(Fragment, Attributes)

Get Java XBRL API implementation at SourceForge.net.