edu.uky.rch.ept.xmlSegmentTree.dom
Class XDocument

java.lang.Object
  extended byorg.dom4j.tree.AbstractNode
      extended byorg.dom4j.tree.AbstractBranch
          extended byorg.dom4j.tree.AbstractDocument
              extended byedu.uky.rch.ept.xmlSegmentTree.dom.XDocument
All Implemented Interfaces:
org.dom4j.Branch, Cloneable, org.dom4j.Document, org.dom4j.Node, Serializable

public class XDocument
extends org.dom4j.tree.AbstractDocument

DOM4J document backed by a SegmentTree. Attempting to modify this document may result in UnsupportedOperationException being thrown. TODO: need to be able to add an element. We don't need to support the dom4j methods, but there should be methods (of XDocument) that support the operations required by the data source layer:

The last is the most difficult to implement, as it modifies the underlying content and can thus change coordinates. There may not be room in the old coordinate system for all the new content. These operations, of course, modify the underlying SegmentTree. However, SegmentTree is immutable; operations that would modify it instead return a new SegmentTree. We need, then, a SegmentTreeChangeListener class to notify users of the segment tree that it was modified.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.dom4j.tree.AbstractBranch
DEFAULT_CONTENT_LIST_SIZE, outputFormat
 
Fields inherited from class org.dom4j.tree.AbstractNode
NODE_TYPE_NAMES
 
Fields inherited from interface org.dom4j.Node
ANY_NODE, ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, MAX_NODE_TYPE, NAMESPACE_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE, UNKNOWN_NODE
 
Constructor Summary
XDocument(SegmentTree st, org.dom4j.DocumentType dt)
          Create a dom4j representation of a segment tree with the specified document type.
XDocument(SegmentTree st, ElementFilter filter)
          Create a dom4j representation of the tags stored in a particular segment tree which match the given filter.
XDocument(SegmentTree st, ElementFilter filter, String rootName)
          Create a dom4j representation of the tags stored in a particular segment tree which match the given filter.
 
Method Summary
 org.dom4j.Document addDocType(String name, String publicId, String systemId)
           
protected  void addNode(org.dom4j.Node node)
           
 void clearContent()
           
protected  List contentList()
           
 org.dom4j.DocumentType getDocType()
           
 EntityResolver getEntityResolver()
           
protected  ElementFilter getFilter()
           
 org.dom4j.Element getRootElement()
           
protected  SegmentTree getSegmentTree()
           
 org.dom4j.ProcessingInstruction processingInstruction(String target)
           
 List processingInstructions()
           
 List processingInstructions(String target)
           
protected  boolean removeNode(org.dom4j.Node node)
           
 boolean removeProcessingInstruction(String target)
           
protected  void rootElementAdded(org.dom4j.Element rootElement)
           
 void setContent(List content)
           
 void setDocType(org.dom4j.DocumentType docType)
           
 void setEntityResolver(EntityResolver entityResolver)
           
 
Methods inherited from class org.dom4j.tree.AbstractDocument
accept, add, addComment, addElement, addElement, addElement, addProcessingInstruction, addProcessingInstruction, asXML, asXPathResult, checkAddElementAllowed, childAdded, childRemoved, getDocument, getNodeType, getPath, getStringValue, getUniquePath, normalize, remove, setRootElement, toString, write
 
Methods inherited from class org.dom4j.tree.AbstractBranch
add, add, add, addElement, appendContent, content, contentRemoved, createContentList, createContentList, createEmptyList, createResultList, createSingleResultList, elementByID, elementID, getContentAsStringValue, getContentAsText, getText, getTextTrim, hasContent, indexOf, invalidNodeTypeAddException, isReadOnly, node, nodeCount, nodeIterator, remove, remove, remove, setProcessingInstructions
 
Methods inherited from class org.dom4j.tree.AbstractNode
clone, createPattern, createXPath, createXPathFilter, createXPathResult, detach, getDocumentFactory, getName, getNodeTypeName, getParent, getPath, getUniquePath, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setName, setParent, setText, supportsParent, valueOf
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.dom4j.Branch
add, add, add, appendContent, content, elementByID, indexOf, node, nodeCount, nodeIterator, remove, remove, remove, setProcessingInstructions
 
Methods inherited from interface org.dom4j.Node
clone, createXPath, detach, getName, getNodeTypeName, getParent, getPath, getText, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setName, setParent, setText, supportsParent, valueOf
 

Constructor Detail

XDocument

public XDocument(SegmentTree st,
                 ElementFilter filter)
          throws HierarchyException
Create a dom4j representation of the tags stored in a particular segment tree which match the given filter. If the document does not have a root element named "document", insert one into the dom4j tree (but not the underlying segment tree).

Parameters:
st - the segment tree backing this dom4j tree.
filter - an ElementFilter matching those elements to be included in the segment tree.

XDocument

public XDocument(SegmentTree st,
                 ElementFilter filter,
                 String rootName)
          throws HierarchyException
Create a dom4j representation of the tags stored in a particular segment tree which match the given filter. If the document does not have a root element named rootName, insert one into the dom4j tree (but not the underlying segment tree).

Parameters:
st - the segment tree backing this dom4j tree.
filter - an ElementFilter matching those elements to be included in the segment tree.
rootName - the name of the document's root element.

XDocument

public XDocument(SegmentTree st,
                 org.dom4j.DocumentType dt)
          throws HierarchyException
Create a dom4j representation of a segment tree with the specified document type. Only elements mentioned in the document type are included, and the XML's root element must have the same name as that specified in the document type.

Parameters:
st - the segment tree backing this dom4j tree.
dt - the document type to apply to the dom4j tree.
Method Detail

addDocType

public org.dom4j.Document addDocType(String name,
                                     String publicId,
                                     String systemId)

getDocType

public org.dom4j.DocumentType getDocType()

getEntityResolver

public EntityResolver getEntityResolver()

getRootElement

public org.dom4j.Element getRootElement()

rootElementAdded

protected void rootElementAdded(org.dom4j.Element rootElement)

setDocType

public void setDocType(org.dom4j.DocumentType docType)

setEntityResolver

public void setEntityResolver(EntityResolver entityResolver)

addNode

protected void addNode(org.dom4j.Node node)

clearContent

public void clearContent()

contentList

protected List contentList()

processingInstruction

public org.dom4j.ProcessingInstruction processingInstruction(String target)

processingInstructions

public List processingInstructions()

processingInstructions

public List processingInstructions(String target)

removeNode

protected boolean removeNode(org.dom4j.Node node)

removeProcessingInstruction

public boolean removeProcessingInstruction(String target)

setContent

public void setContent(List content)

getSegmentTree

protected SegmentTree getSegmentTree()

getFilter

protected ElementFilter getFilter()