com.taursys.dom
Interface DocumentAdapter

All Known Implementing Classes:
DOM_1_20000929_DocumentAdapter

public interface DocumentAdapter

DocumentAdapter for All DOM Document versions. This interface provides a common, version safe access to the DOM document. This interface contains a small number of methods that must be implemented for any DOM version which this application will support.

This should be considered an internal interface and is subject to change.


Method Summary
 org.w3c.dom.Document getDocument()
          Returns the Document/adaptee of this DocumentAdapter
 org.w3c.dom.Element getElementById(java.lang.String elementId)
          Returns the Element for the given mapped identifier else null if not found.
 java.util.Hashtable getIdentifierMap()
          Returns a Hashtable of id's and their cooresponding Elements for this document.
 void importContents(DocumentAdapter sourceAdapter, java.lang.String sourceId, java.lang.String destId)
          Import the contents from the given sourceAdapter at the sourceId and replace the contents of the destId in this DocumentAdapter.
 void removeAttribute(java.lang.String elementId, java.lang.String attribute)
          Removes the given attribute from the element identified by the given id Does nothing if the id is not found.
 void setAttributeText(java.lang.String elementId, java.lang.String attribute, java.lang.String value)
          Stores given value as a text attribute of the element identified by the given id Does nothing if the id is not found.
 void setElementText(java.lang.String elementId, java.lang.String value)
          Sets the Text of the Element indicated by the given id to the given value.
 void write(java.io.OutputStream stream)
          Write the document to the given OutputStream.
 void write(java.io.Writer writer)
          Write the document to the given Writer.
 

Method Detail

write

public void write(java.io.OutputStream stream)
Write the document to the given OutputStream.

Parameters:
stream - to render the document to

write

public void write(java.io.Writer writer)
Write the document to the given Writer.

Parameters:
writer - to render the document to

setElementText

public void setElementText(java.lang.String elementId,
                           java.lang.String value)
Sets the Text of the Element indicated by the given id to the given value.


setAttributeText

public void setAttributeText(java.lang.String elementId,
                             java.lang.String attribute,
                             java.lang.String value)
Stores given value as a text attribute of the element identified by the given id Does nothing if the id is not found. If the given value is null, it renders the attribute as blank ("").


removeAttribute

public void removeAttribute(java.lang.String elementId,
                            java.lang.String attribute)
Removes the given attribute from the element identified by the given id Does nothing if the id is not found.


getElementById

public org.w3c.dom.Element getElementById(java.lang.String elementId)
Returns the Element for the given mapped identifier else null if not found.


getDocument

public org.w3c.dom.Document getDocument()
Returns the Document/adaptee of this DocumentAdapter


importContents

public void importContents(DocumentAdapter sourceAdapter,
                           java.lang.String sourceId,
                           java.lang.String destId)
                    throws DocumentAdapterException
Import the contents from the given sourceAdapter at the sourceId and replace the contents of the destId in this DocumentAdapter. All the child contents of the sourceId are copied (not including the element with the sourceId). The id's are then re-mapped for this document.

Parameters:
sourceAdapter - the source DocumentAdapter for the import
sourceId - the parent element to import contents from
destId - the parent element to import the contents to
Throws:
java.lang.IllegalArgumentException - if any arguments are null
DocumentAdapterException - if sourceId or destId is invalid

getIdentifierMap

public java.util.Hashtable getIdentifierMap()
Returns a Hashtable of id's and their cooresponding Elements for this document. This is built by mapIdentifiers method.

Returns:
a Hashtable of id's and their cooresponding Elements


Copyright © 2007 Martin T Phelan. All Rights Reserved.