net.sourceforge.xbrlcomposer
Class DTS

java.lang.Object
  extended bynet.sourceforge.xbrlcomposer.DTS

public class DTS
extends java.lang.Object


Field Summary
static java.lang.String CompositeNamespace
          CompositeNamespace is the namespace for the elements and attributes specific to DTSImpl composite documents
static java.lang.String CompositePrefix
          CompositeNamespace prefix
static java.lang.String XBRL20LinkNamespace
           
static java.lang.String XBRL20Namespace
           
static java.lang.String XBRL21LinkNamespace
          XBRLLinkNamespace is the namespace for the XBRL Link elements
static java.lang.String XBRL21Namespace
          XBRLNamespace is the namespace for the XBRL Instance elements
static java.lang.String XLinkNamespace
          XLinkNamespace is the namespace for the XLink
static java.lang.String XLinkPrefix
          XLinkNamespace prefix
static java.lang.String XMLNamespace
          XMLNamespace is the namespace for the XLink elements
static java.lang.String XMLSchemaNamespace
          XMLSchemaNamespace is the namespace for the elements and attributes specific to XML Schema
static java.lang.String XMLSchemaPrefix
          XMLSchemaNamespace prefix
 
Constructor Summary
DTS()
          DTSImpl constructor with no inputs.
DTS(java.io.File file)
          DTSImpl constructor taking the URL of a serialised DTSImpl as an input point documents.
DTS(java.lang.String[] startingURLs)
          DTSImpl constructor taking an array of string URL's of starting point documents.
 
Method Summary
 void addFileToDTS()
          Add a file element to the DTSImpl to contain a new file in the DTSImpl.
 void appendComment(java.lang.String data)
          Append a comment to the composite document.
 void appendProcessingInstruction(java.lang.String target, java.lang.String data)
          Append a processing instruction to the composite document
 void appendText(java.lang.String text)
          Append a text node to the composite document
 void augmentDTSDocuments(java.util.List newStartingURLs)
          Augment a DTSImpl with additional documents
 void augmentDTSDocuments(java.lang.String[] newStartingURLs)
          Augment a DTSImpl with additional documents
 void decompose(java.io.File cacheRoot)
          Decomposes the DTSImpl into the original files in a taxonomy cache.
 void finishedWithAnElement()
          Step up to element's parent having finished with the element.
 void finishFileInDTS()
          Finish processing a file in the DTSImpl
 org.w3c.dom.Document getDocument()
          Get the document DOM object representing the DTSImpl as an XML object
 org.xml.sax.EntityResolver getEntityResolver()
          Get the resolver for the DTSImpl
 java.util.HashMap getIndex()
          Get the index map for the DTSImpl
 org.w3c.dom.Element getIndexedFragment(java.lang.String key)
          Get an XML fragment in the DTSImpl given its index
 org.w3c.dom.Element getRoot()
          Get the root element
 void getRoot(org.w3c.dom.Element root)
          Set the root element
 java.net.URI getTargetNamespaceURI()
          Get the targetNamespaceURI for the schema being processed
 void handleElementEnd(java.lang.String namespaceURI, java.lang.String sName, java.lang.String qName)
          Called by the SAX content handler to wrap up the processing of elements.
 void handleElementStart(java.lang.String namespaceURI, java.lang.String lName, java.lang.String qName, org.xml.sax.Attributes attrs)
          Called by the SAX content handler Identify elements requiring specific treatment and handle appropriately, otherwise just insert the element at the current location in the composite document.
 boolean isParsingXBRLInstance()
          Get the value of the boolean indicating that an XBRL instance is being parsed
 void loadDTSDocuments()
          Loads the documents identified as part of the DTSImpl.
static void main(java.lang.String[] argv)
          Class entry point for execution.
 void processExtendedLink()
          Process the arcs in an extended link.
 void saveToFile(java.io.File file)
          Save the DTSImpl DOM object to an XML file.
 void saveToFile(java.io.OutputStream outputStream)
          Save the DTSImpl DOM object to an XML file.
 void saveToFile(java.lang.String filename)
          Save the DTSImpl DOM object to an XML file.
 boolean selectBoolean(java.lang.String xPath, org.w3c.dom.Element element)
          Evaluate an XPath expression against an element in the DTSImpl DOM
 org.w3c.dom.Node selectNode(java.lang.String xPath, org.w3c.dom.Element element)
          Evaluate an XPath expression against an element in the DTSImpl DOM
 org.w3c.dom.xpath.XPathResult selectNodes(java.lang.String xPath, org.w3c.dom.Element element)
          Evaluate an XPath expression against an element in the DTSImpl DOM
 org.w3c.dom.xpath.XPathResult selectNodesSnapshot(java.lang.String xPath, org.w3c.dom.Element element)
          Evaluate an XPath expression against an element in the DTSImpl DOM
 double selectNumber(java.lang.String xPath, org.w3c.dom.Element element)
          Evaluate an XPath expression against an element in the DTSImpl DOM
 java.lang.String selectString(java.lang.String xPath, org.w3c.dom.Element element)
          Evaluate an XPath expression against an element in the DTSImpl DOM
 void setEntityResolver(org.xml.sax.EntityResolver resolver)
          Set the resolver for the DTSImpl
 void setIndexedFragment(java.lang.String key, org.w3c.dom.Element fragment)
          Set a fragment in the DTSImpl Note that this does not check that the key is unique or that the fragment is part of the DTSImpl XML DOM object.
 void setParsingXBRLInstance(boolean parsing)
          Set the boolean indicating that an XBRL instance is being parsed
 void setStartingPoints(java.util.List startingDocuments)
          Set the starting points for DTSImpl discovery using a linked list
 void setStartingPoints(java.lang.String[] startingDocuments)
          Set the starting points for DTSImpl discovery using a linked list
 void setTargetNamespaceURI(java.net.URI targetNamespaceURI)
          Set the targetNamespaceURI for the schema being processed
 java.lang.String toString()
          Returns the string representation of the DTSImpl
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

XMLNamespace

public static final java.lang.String XMLNamespace
XMLNamespace is the namespace for the XLink elements

See Also:
Constant Field Values

XLinkNamespace

public static final java.lang.String XLinkNamespace
XLinkNamespace is the namespace for the XLink

See Also:
Constant Field Values

XBRL21Namespace

public static final java.lang.String XBRL21Namespace
XBRLNamespace is the namespace for the XBRL Instance elements

See Also:
Constant Field Values

XBRL20Namespace

public static final java.lang.String XBRL20Namespace
See Also:
Constant Field Values

XBRL21LinkNamespace

public static final java.lang.String XBRL21LinkNamespace
XBRLLinkNamespace is the namespace for the XBRL Link elements

See Also:
Constant Field Values

XBRL20LinkNamespace

public static final java.lang.String XBRL20LinkNamespace
See Also:
Constant Field Values

CompositeNamespace

public static final java.lang.String CompositeNamespace
CompositeNamespace is the namespace for the elements and attributes specific to DTSImpl composite documents

See Also:
Constant Field Values

XMLSchemaNamespace

public static final java.lang.String XMLSchemaNamespace
XMLSchemaNamespace is the namespace for the elements and attributes specific to XML Schema

See Also:
Constant Field Values

XLinkPrefix

public static final java.lang.String XLinkPrefix
XLinkNamespace prefix

See Also:
Constant Field Values

XMLSchemaPrefix

public static final java.lang.String XMLSchemaPrefix
XMLSchemaNamespace prefix

See Also:
Constant Field Values

CompositePrefix

public static final java.lang.String CompositePrefix
CompositeNamespace prefix

See Also:
Constant Field Values
Constructor Detail

DTS

public DTS()
    throws DTSException
DTSImpl constructor with no inputs. Before a document is created, a set of starting URLs will need to be provided using setStartingPoints(java.util.List).

Throws:
DTSException

DTS

public DTS(java.lang.String[] startingURLs)
    throws DTSException
DTSImpl constructor taking an array of string URL's of starting point documents.

Parameters:
startingURLs - An array of strings, each of which is a URL for a DTSImpl discovery starting point.
Throws:
DTSException

DTS

public DTS(java.io.File file)
    throws DTSException
DTSImpl constructor taking the URL of a serialised DTSImpl as an input point documents.

Parameters:
file - the DTSImpl file
Throws:
DTSException
Method Detail

main

public static void main(java.lang.String[] argv)
                 throws DTSException
Class entry point for execution. Use this method to trigger the creation of a discoverable taxonomy set composite object, passing in a set of URL strings for the documents that form the starting point for document discovery.

Parameters:
argv - array of command line arguments
Throws:
DTSException

getIndex

public java.util.HashMap getIndex()
                           throws DTSException
Get the index map for the DTSImpl

Throws:
DTSException

getEntityResolver

public org.xml.sax.EntityResolver getEntityResolver()
                                             throws DTSException
Get the resolver for the DTSImpl

Throws:
DTSException

setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver resolver)
                       throws DTSException
Set the resolver for the DTSImpl

Parameters:
resolver - A custom entity resolver implementation
Throws:
DTSException

setIndexedFragment

public void setIndexedFragment(java.lang.String key,
                               org.w3c.dom.Element fragment)
                        throws DTSException
Set a fragment in the DTSImpl Note that this does not check that the key is unique or that the fragment is part of the DTSImpl XML DOM object. Both of these checks should be implemented.

Parameters:
key - Index value for an indexed XML fragment in the DTSImpl
fragment - XML fragment in the DTSImpl DOM
Throws:
DTSException

getIndexedFragment

public org.w3c.dom.Element getIndexedFragment(java.lang.String key)
                                       throws DTSException
Get an XML fragment in the DTSImpl given its index

Parameters:
key - Index value for an indexed XML fragment in the DTSImpl
Throws:
DTSException

getDocument

public org.w3c.dom.Document getDocument()
                                 throws DTSException
Get the document DOM object representing the DTSImpl as an XML object

Throws:
DTSException

getTargetNamespaceURI

public java.net.URI getTargetNamespaceURI()
                                   throws DTSException
Get the targetNamespaceURI for the schema being processed

Throws:
DTSException

setTargetNamespaceURI

public void setTargetNamespaceURI(java.net.URI targetNamespaceURI)
                           throws DTSException
Set the targetNamespaceURI for the schema being processed

Throws:
DTSException

setParsingXBRLInstance

public void setParsingXBRLInstance(boolean parsing)
                            throws DTSException
Set the boolean indicating that an XBRL instance is being parsed

Parameters:
parsing - Indicates whether an XBRL instance is being parsed or not.
Throws:
DTSException

isParsingXBRLInstance

public boolean isParsingXBRLInstance()
                              throws DTSException
Get the value of the boolean indicating that an XBRL instance is being parsed

Throws:
DTSException

getRoot

public org.w3c.dom.Element getRoot()
                            throws DTSException
Get the root element

Throws:
DTSException

getRoot

public void getRoot(org.w3c.dom.Element root)
             throws DTSException
Set the root element

Parameters:
root - the root element for the dts
Throws:
DTSException

setStartingPoints

public void setStartingPoints(java.util.List startingDocuments)
                       throws DTSException
Set the starting points for DTSImpl discovery using a linked list

Parameters:
startingDocuments - A list of starting point document URLs for DTSImpl discovery
Throws:
DTSException

setStartingPoints

public void setStartingPoints(java.lang.String[] startingDocuments)
                       throws DTSException
Set the starting points for DTSImpl discovery using a linked list

Parameters:
startingDocuments - A string array of starting point document URLs for DTSImpl discovery
Throws:
DTSException

loadDTSDocuments

public void loadDTSDocuments()
                      throws DTSException
Loads the documents identified as part of the DTSImpl. On completion the current index number value is stored in the root element.

Throws:
DTSException

augmentDTSDocuments

public void augmentDTSDocuments(java.lang.String[] newStartingURLs)
                         throws DTSException
Augment a DTSImpl with additional documents

Throws:
DTSException

augmentDTSDocuments

public void augmentDTSDocuments(java.util.List newStartingURLs)
                         throws DTSException
Augment a DTSImpl with additional documents

Throws:
DTSException

addFileToDTS

public void addFileToDTS()
                  throws DTSException
Add a file element to the DTSImpl to contain a new file in the DTSImpl.

Throws:
DTSException

finishFileInDTS

public void finishFileInDTS()
                     throws DTSException
Finish processing a file in the DTSImpl

Throws:
DTSException

processExtendedLink

public void processExtendedLink()
                         throws DTSException
Process the arcs in an extended link. Processing involves iterating down through the stack of arcs in the extended link, processing each one to establish the relationships being described by the arc being processed. Extended link processing is triggered once the closing tag for an extended link is parsed by the SAX parser.

Throws:
DTSException

finishedWithAnElement

public void finishedWithAnElement()
                           throws DTSException
Step up to element's parent having finished with the element.

Throws:
DTSException

handleElementStart

public void handleElementStart(java.lang.String namespaceURI,
                               java.lang.String lName,
                               java.lang.String qName,
                               org.xml.sax.Attributes attrs)
                        throws DTSException
Called by the SAX content handler Identify elements requiring specific treatment and handle appropriately, otherwise just insert the element at the current location in the composite document.

Parameters:
namespaceURI - The namespace of the element found by the SAX parser.
lName - The local name of the element found by the SAX parser.
qName - The QName of the element found by the SAX parser.
attrs - The set of attributes found by the SAX parser.
Throws:
DTSException

handleElementEnd

public void handleElementEnd(java.lang.String namespaceURI,
                             java.lang.String sName,
                             java.lang.String qName)
                      throws DTSException
Called by the SAX content handler to wrap up the processing of elements. Handles the various actions required to alter the state of the dts as a function of the end of an element being parsed into the DTSImpl. The handling involves: 1. Setting the targetNamespaceURI to null when we finish parsing a schema 2. Setting the flag indicating that an XBRL instance is being parsed to null when the end of an XBRL instance is reached. 3. Doing the housekeeping necessary to end the element in the DTSImpl structure.

Parameters:
namespaceURI - The namespace of the element found by the SAX parser.
sName - The local name of the element found by the SAX parser.
qName - The QName of the element found by the SAX parser.
Throws:
DTSException

appendText

public void appendText(java.lang.String text)
                throws DTSException
Append a text node to the composite document

Parameters:
text - The text to be appended to the current element.
Throws:
DTSException

appendProcessingInstruction

public void appendProcessingInstruction(java.lang.String target,
                                        java.lang.String data)
                                 throws DTSException
Append a processing instruction to the composite document

Parameters:
target - The processing target application identifier.
data - The data defining what is to be done.
Throws:
DTSException

appendComment

public void appendComment(java.lang.String data)
                   throws DTSException
Append a comment to the composite document. This needs a Lexical Handler to provide comment events.

Parameters:
data - The data constituting the content of the comment.
Throws:
DTSException

saveToFile

public void saveToFile(java.lang.String filename)
                throws DTSException
Save the DTSImpl DOM object to an XML file.

Parameters:
filename - The name of the file to be used to store the DTSImpl XML file.
Throws:
DTSException

saveToFile

public void saveToFile(java.io.File file)
                throws DTSException
Save the DTSImpl DOM object to an XML file.

Parameters:
file - The file object documenting the file to be created.
Throws:
DTSException

saveToFile

public void saveToFile(java.io.OutputStream outputStream)
                throws DTSException
Save the DTSImpl DOM object to an XML file. Useful for serializing to standard output for example.

Parameters:
outputStream - The output stream that the serialized DTSImpl is sent to.
Throws:
DTSException

selectBoolean

public boolean selectBoolean(java.lang.String xPath,
                             org.w3c.dom.Element element)
                      throws DTSException
Evaluate an XPath expression against an element in the DTSImpl DOM

Parameters:
xPath - String XPath expression to evaluate against the specified element
element - The element used as the context node for XPath evaluation
Throws:
DTSException

selectString

public java.lang.String selectString(java.lang.String xPath,
                                     org.w3c.dom.Element element)
                              throws DTSException
Evaluate an XPath expression against an element in the DTSImpl DOM

Parameters:
xPath - String XPath expression to evaluate against the specified element
element - The element used as the context node for XPath evaluation
Throws:
DTSException

selectNumber

public double selectNumber(java.lang.String xPath,
                           org.w3c.dom.Element element)
                    throws DTSException
Evaluate an XPath expression against an element in the DTSImpl DOM

Parameters:
xPath - String XPath expression to evaluate against the specified element
element - The element used as the context node for XPath evaluation
Throws:
DTSException

selectNode

public org.w3c.dom.Node selectNode(java.lang.String xPath,
                                   org.w3c.dom.Element element)
                            throws DTSException
Evaluate an XPath expression against an element in the DTSImpl DOM

Parameters:
xPath - String XPath expression to evaluate against the specified element
element - The element used as the context node for XPath evaluation
Throws:
DTSException

selectNodes

public org.w3c.dom.xpath.XPathResult selectNodes(java.lang.String xPath,
                                                 org.w3c.dom.Element element)
                                          throws DTSException
Evaluate an XPath expression against an element in the DTSImpl DOM

Parameters:
xPath - String XPath expression to evaluate against the specified element
element - The element used as the context node for XPath evaluation
Throws:
DTSException

selectNodesSnapshot

public org.w3c.dom.xpath.XPathResult selectNodesSnapshot(java.lang.String xPath,
                                                         org.w3c.dom.Element element)
                                                  throws DTSException
Evaluate an XPath expression against an element in the DTSImpl DOM

Parameters:
xPath - String XPath expression to evaluate against the specified element
element - The element used as the context node for XPath evaluation
Throws:
DTSException

toString

public java.lang.String toString()
Returns the string representation of the DTSImpl


decompose

public void decompose(java.io.File cacheRoot)
               throws DTSException
Decomposes the DTSImpl into the original files in a taxonomy cache.

Parameters:
cacheRoot - The directory under which the files are written.
Throws:
DTSException