Enhydra 5.1 API

org.enhydra.xml.xmlc
Interface XMLObject

All Superinterfaces:
Document, DocumentInfo, Node
All Known Subinterfaces:
HTMLObject
All Known Implementing Classes:
HTMLObjectImpl, XMLObjectImpl

public interface XMLObject
extends Document, DocumentInfo

Interface for all compiled XML objects.


Field Summary
static java.lang.String XMLC_GENERATED_CLASS_FIELD_NAME
          The name of the class field that is used to identify an XMLC generated class.
static java.lang.String XMLC_SOURCE_FILE_FIELD_NAME
          Field name in the generated class that contains the name of the source file.
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Method Summary
 Node adoptNode(Node source)
          EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001..
 void buildDocument()
          Generated method to build the DOM.
 XMLObject getDelegate()
          Get the delegate.
 Document getDocument()
          Get the actual document object.
 java.lang.String getEncoding()
          Get the encoding specified in the document.
 java.lang.String getMIMEType()
          Get the MIME type associated with the document, or null if none was associated.
 boolean getStandalone()
          EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001..
 boolean getStrictErrorChecking()
          EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001..
 java.lang.String getVersion()
          EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001..
 void setDelegate(XMLObject delegate)
          Set the delegate object.
 void setEncoding(java.lang.String encoding)
          EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001..
 void setStandalone(boolean standalone)
          EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001..
 void setStrictErrorChecking(boolean strictErrorChecking)
          EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001..
 void setVersion(java.lang.String version)
          EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001..
 void syncAccessMethods()
          Initialize the fields used by the generated access methods from the current state of the document.
 java.lang.String toDocument()
          Convert the document to a string representation of the document, that is a string containing XML.
 
Methods inherited from interface org.w3c.dom.Document
createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, getDoctype, getDocumentElement, getElementById, getElementsByTagName, getElementsByTagNameNS, getImplementation, importNode
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix
 
Methods inherited from interface org.enhydra.xml.io.DocumentInfo
isURLAttribute
 

Field Detail

XMLC_GENERATED_CLASS_FIELD_NAME

public static final java.lang.String XMLC_GENERATED_CLASS_FIELD_NAME
The name of the class field that is used to identify an XMLC generated class. The field will contain a reference to the Class object for the class. This is used to find the XMLC generated class in an inheritance hierarchy.

See Also:
Constant Field Values

XMLC_SOURCE_FILE_FIELD_NAME

public static final java.lang.String XMLC_SOURCE_FILE_FIELD_NAME
Field name in the generated class that contains the name of the source file. This is used to find the source file for recompilation. It is a relative file path, normally the name of the file within the package containing the class.

See Also:
Constant Field Values
Method Detail

buildDocument

public void buildDocument()
Generated method to build the DOM. This is normally call by the constructor. However, one of the generated constructors takes a boolean flag to indicate if this should be called automatically. This method may also be called to reinitialize the object to its empty state.


setDelegate

public void setDelegate(XMLObject delegate)
Set the delegate object. Delegation is used to support automatic recompilation of documents into XMLC objects. If the delegate is not null, the methods of the delegate are called to handle most of the methods of this object.

Parameters:
delegate - The delegate object, or null to remove delegation. The delegate must implement the same interface as the derived, generate object.

syncAccessMethods

public void syncAccessMethods()
Initialize the fields used by the generated access methods from the current state of the document. Missing DOM element ids will result in their acccess method returning null.


getDelegate

public XMLObject getDelegate()
Get the delegate.

Returns:
The delegate object, or null if there is no delegate.

getDocument

public Document getDocument()
Get the actual document object. One should normally just use the XMLObject methods to access the Document functionality, this is for the initialization of derived objects.


getMIMEType

public java.lang.String getMIMEType()
Get the MIME type associated with the document, or null if none was associated.


getEncoding

public java.lang.String getEncoding()
Get the encoding specified in the document. Note that this is the symbolic name of the XML encoding, which is not the same as the Java encoding names.

Specified by:
getEncoding in interface Document
Returns:
the encoding or null if no encoding was explicitly specified.
See Also:
DOMFormatter, OutputOptions

setEncoding

public void setEncoding(java.lang.String encoding)
Description copied from interface: Document

EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001..

An attribute specifying, as part of the XML declaration, the encoding of this document. This is null when unspecified.

Specified by:
setEncoding in interface Document
See Also:
Document.setEncoding(java.lang.String)

getStandalone

public boolean getStandalone()
Description copied from interface: Document

EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001..

An attribute specifying, as part of the XML declaration, whether this document is standalone.

Specified by:
getStandalone in interface Document
See Also:
Document.getStandalone()

setStandalone

public void setStandalone(boolean standalone)
Description copied from interface: Document

EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001..

An attribute specifying, as part of the XML declaration, whether this document is standalone.

Specified by:
setStandalone in interface Document
See Also:
Document.setStandalone(boolean)

getStrictErrorChecking

public boolean getStrictErrorChecking()
Description copied from interface: Document

EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001..

An attribute specifying whether errors checking is enforced or not. When set to false, the implementation is free to not test every possible error case normally defined on DOM operations, and not raise any DOMException. In case of error, the behavior is undefined. This attribute is true by defaults.

Specified by:
getStrictErrorChecking in interface Document
See Also:
Document.getStrictErrorChecking()

setStrictErrorChecking

public void setStrictErrorChecking(boolean strictErrorChecking)
Description copied from interface: Document

EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001..

An attribute specifying whether errors checking is enforced or not. When set to false, the implementation is free to not test every possible error case normally defined on DOM operations, and not raise any DOMException. In case of error, the behavior is undefined. This attribute is true by defaults.

Specified by:
setStrictErrorChecking in interface Document
See Also:
Document.setStrictErrorChecking(boolean)

getVersion

public java.lang.String getVersion()
Description copied from interface: Document

EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001..

An attribute specifying, as part of the XML declaration, the version number of this document. This is null when unspecified.

Specified by:
getVersion in interface Document
See Also:
Document.getVersion()

setVersion

public void setVersion(java.lang.String version)
Description copied from interface: Document

EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001..

An attribute specifying, as part of the XML declaration, the version number of this document. This is null when unspecified.

Specified by:
setVersion in interface Document
See Also:
Document.setVersion(java.lang.String)

adoptNode

public Node adoptNode(Node source)
               throws DOMException
Description copied from interface: Document

EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001..

Changes the ownerDocument of a node, its children, as well as the attached attribute nodes if there are any. If the node has a parent it is first removed from its parent child list. This effectively allows moving a subtree from one document to another. The following list describes the specifics for each type of node.

ATTRIBUTE_NODE
The ownerElement attribute is set to null and the specified flag is set to true on the adopted Attr. The descendants of the source Attr are recursively adopted.
DOCUMENT_FRAGMENT_NODE
The descendants of the source node are recursively adopted.
DOCUMENT_NODE
Document nodes cannot be adopted.
DOCUMENT_TYPE_NODE
DocumentType nodes cannot be adopted.
ELEMENT_NODE
Specified attribute nodes of the source element are adopted, and the generated Attr nodes. Default attributes are discarded, though if the document being adopted into defines default attributes for this element name, those are assigned. The descendants of the source element are recursively adopted.
ENTITY_NODE
Entity nodes cannot be adopted.
ENTITY_REFERENCE_NODE
Only the EntityReference node itself is adopted, the descendants are discarded, since the source and destination documents might have defined the entity differently. If the document being imported into provides a definition for this entity name, its value is assigned.
NOTATION_NODE
Notation nodes cannot be adopted.
PROCESSING_INSTRUCTION_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE
These nodes can all be adopted. No specifics.
Should this method simply return null when it fails? How "exceptional" is failure for this method?Stick with raising exceptions only in exceptional circumstances, return null on failure (F2F 19 Jun 2000).Can an entity node really be adopted?No, neither can Notation nodes (Telcon 13 Dec 2000).Does this affect keys and hashCode's of the adopted subtree nodes?If so, what about readonly-ness of key and hashCode?if not, would appendChild affect keys/hashCodes or would it generate exceptions if key's are duplicate? Update: Hashcodes have been dropped. Given that the key is only unique within a document an adopted node needs to be given a new key, but what does it mean for the application?

Specified by:
adoptNode in interface Document
Parameters:
source - The node to move into this document.
Returns:
The adopted node, or null if this operation fails, such as when the source node comes from a different implementation.
Throws:
DOMException - NOT_SUPPORTED_ERR: Raised if the source node is of type DOCUMENT, DOCUMENT_TYPE.
NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is readonly.
See Also:
Document.adoptNode(org.w3c.dom.Node)

toDocument

public java.lang.String toDocument()
Convert the document to a string representation of the document, that is a string containing XML. The results are parsable into the same DOM hierarchy. The formatting provided by this method does not begin to cover all of the issues involved with publishing a XML document, such as character encoding. Use the DOMFormatter class if more options are required.

Returns:
A string containing the full XML.
See Also:
DOMFormatter

Enhydra 5.1 API