org.enhydra.xml.xmlc
Class XMLObjectImpl

java.lang.Object
  |
  +--org.enhydra.xml.xmlc.XMLObjectImpl
All Implemented Interfaces:
org.w3c.dom.Document, DocumentInfo, org.w3c.dom.Node, XMLObject
Direct Known Subclasses:
HTMLObjectImpl

public abstract class XMLObjectImpl
extends java.lang.Object
implements XMLObject, org.w3c.dom.Document, DocumentInfo

Base class for all compiled XML objects.

See Also:
XMLObject

Field Summary
 
Fields inherited from interface org.enhydra.xml.xmlc.XMLObject
XMLC_GENERATED_CLASS_FIELD_NAME, XMLC_SOURCE_FILE_FIELD_NAME
 
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
 
Constructor Summary
protected XMLObjectImpl()
          Constructor.
 
Method Summary
 org.w3c.dom.Node adoptNode(org.w3c.dom.Node source)
           
 org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
           
protected  void cloneDeepCheck(boolean deep)
          Check that cloneNode on an entire document is done with the deep option.
abstract  org.w3c.dom.Node cloneNode(boolean deep)
          Clone the entire document.
 org.w3c.dom.Attr createAttribute(java.lang.String qualifiedName)
           
 org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
           
 org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
           
 org.w3c.dom.Comment createComment(java.lang.String data)
           
 org.w3c.dom.DocumentFragment createDocumentFragment()
           
 org.w3c.dom.Element createElement(java.lang.String tagName)
           
 org.w3c.dom.Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
           
 org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
           
 org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)
           
 org.w3c.dom.Text createTextNode(java.lang.String data)
           
protected  void doSetText(org.w3c.dom.Element element, java.lang.String text)
          Used internally to implement a setTextXXX() method.
 org.w3c.dom.NamedNodeMap getAttributes()
           
 org.w3c.dom.NodeList getChildNodes()
           
 XMLObject getDelegate()
          Get the delegate.
 org.w3c.dom.DocumentType getDoctype()
           
 org.w3c.dom.Document getDocument()
          Get the actual document object.
 org.w3c.dom.Element getDocumentElement()
           
protected abstract  XMLCDomFactory getDomFactory()
          Get the XMLC DOM Factory associated with this document type and DOM implementation.
 org.w3c.dom.Element getElementById(java.lang.String elementId)
           
 org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname)
           
 org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
           
 java.lang.String getEncoding()
          Get the encoding specified in the document.
 org.w3c.dom.Node getFirstChild()
           
 org.w3c.dom.DOMImplementation getImplementation()
           
 org.w3c.dom.Node getLastChild()
           
 java.lang.String getLocalName()
           
 java.lang.String getMIMEType()
          Get the MIME type associated with the document, or null if none was associated.
 java.lang.String getNamespaceURI()
           
 org.w3c.dom.Node getNextSibling()
           
 java.lang.String getNodeName()
           
 short getNodeType()
           
 java.lang.String getNodeValue()
           
 org.w3c.dom.Document getOwnerDocument()
           
 org.w3c.dom.Node getParentNode()
           
 java.lang.String getPrefix()
           
 org.w3c.dom.Node getPreviousSibling()
           
 boolean getStandalone()
           
 boolean getStrictErrorChecking()
           
 java.lang.String getVersion()
           
 boolean hasAttributes()
           
 boolean hasChildNodes()
           
 org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode, boolean deep)
           
 void initFields()
          Deprecated. Use syncAccessMethods() instead.
 org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
           
 boolean isSupported(java.lang.String feature, java.lang.String version)
           
 boolean isURLAttribute(org.w3c.dom.Element element, java.lang.String attrName)
          Determine if an attribute of an element can contain a URL.
 void normalize()
           
 org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
           
 org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)
           
 void setDelegate(XMLObject delegate)
          Set the delegate object.
protected  void setDocument(org.w3c.dom.Document document, java.lang.String mimeType, java.lang.String encoding)
          Set the DOM document associated with this object and optional encoding.
 void setEncoding(java.lang.String encoding)
           
 void setNodeValue(java.lang.String nodeValue)
           
 void setPrefix(java.lang.String prefix)
           
 void setStandalone(boolean standalone)
           
 void setStrictErrorChecking(boolean strictErrorChecking)
           
 void setVersion(java.lang.String version)
           
 void syncAccessMethods()
          Initialize the fields used by the generated access methods from the current state of the document.
protected abstract  void syncWithDocument(org.w3c.dom.Node node)
          Generated function to synchronize the fields used by the access methods.
 java.lang.String toDocument()
          Convert the document to a string representation of the document, that is a string containing XML.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.enhydra.xml.xmlc.XMLObject
buildDocument
 

Constructor Detail

XMLObjectImpl

protected XMLObjectImpl()
Constructor. The setDocument() method must be called to associate a document with this object.

Method Detail

setDocument

protected void setDocument(org.w3c.dom.Document document,
                           java.lang.String mimeType,
                           java.lang.String encoding)
Set the DOM document associated with this object and optional encoding. This is used by buildDocument() to set the new document. It is done separately from the constructor to allow buildDocument() to not be called immediatly.


getDomFactory

protected abstract XMLCDomFactory getDomFactory()
Get the XMLC DOM Factory associated with this document type and DOM implementation.


getDocument

public org.w3c.dom.Document getDocument()
Description copied from interface: XMLObject
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.

Specified by:
getDocument in interface XMLObject
See Also:
XMLObject.getDocument()

getMIMEType

public java.lang.String getMIMEType()
Description copied from interface: XMLObject
Get the MIME type associated with the document, or null if none was associated.

Specified by:
getMIMEType in interface XMLObject
See Also:
XMLObject.getMIMEType()

setDelegate

public void setDelegate(XMLObject delegate)
Description copied from interface: XMLObject
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.

Specified by:
setDelegate in interface XMLObject
Parameters:
delegate - The delegate object, or null to remove delegation. The delegate must implement the same interface as the derived, generate object.
See Also:
XMLObject.setDelegate(org.enhydra.xml.xmlc.XMLObject)

getDelegate

public XMLObject getDelegate()
Description copied from interface: XMLObject
Get the delegate.

Specified by:
getDelegate in interface XMLObject
Returns:
The delegate object, or null if there is no delegate.
See Also:
XMLObject.getDelegate()

cloneDeepCheck

protected void cloneDeepCheck(boolean deep)
Check that cloneNode on an entire document is done with the deep option.


cloneNode

public abstract org.w3c.dom.Node cloneNode(boolean deep)
Clone the entire document. Derived objects should override this to get the correct derived type. Cloning with deep being false is not allowed.

Specified by:
cloneNode in interface org.w3c.dom.Node
See Also:
Node.cloneNode(boolean)

getDoctype

public org.w3c.dom.DocumentType getDoctype()
Specified by:
getDoctype in interface org.w3c.dom.Document
See Also:
Document.getDoctype()

getImplementation

public org.w3c.dom.DOMImplementation getImplementation()
Specified by:
getImplementation in interface org.w3c.dom.Document
See Also:
Document.getImplementation()

getDocumentElement

public org.w3c.dom.Element getDocumentElement()
Specified by:
getDocumentElement in interface org.w3c.dom.Document
See Also:
Document.getDocumentElement()

importNode

public org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode,
                                   boolean deep)
                            throws org.w3c.dom.DOMException
Specified by:
importNode in interface org.w3c.dom.Document
org.w3c.dom.DOMException
See Also:
Document.importNode(org.w3c.dom.Node, boolean)

createElement

public org.w3c.dom.Element createElement(java.lang.String tagName)
                                  throws org.w3c.dom.DOMException
Specified by:
createElement in interface org.w3c.dom.Document
org.w3c.dom.DOMException
See Also:
Document.createElement(java.lang.String)

createElementNS

public org.w3c.dom.Element createElementNS(java.lang.String namespaceURI,
                                           java.lang.String qualifiedName)
                                    throws org.w3c.dom.DOMException
Specified by:
createElementNS in interface org.w3c.dom.Document
org.w3c.dom.DOMException
See Also:
Document.createElementNS(java.lang.String, java.lang.String)

createDocumentFragment

public org.w3c.dom.DocumentFragment createDocumentFragment()
Specified by:
createDocumentFragment in interface org.w3c.dom.Document
See Also:
Document.createDocumentFragment()

createTextNode

public org.w3c.dom.Text createTextNode(java.lang.String data)
Specified by:
createTextNode in interface org.w3c.dom.Document
See Also:
Document.createTextNode(java.lang.String)

createComment

public org.w3c.dom.Comment createComment(java.lang.String data)
Specified by:
createComment in interface org.w3c.dom.Document
See Also:
Document.createComment(java.lang.String)

createCDATASection

public org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
                                            throws org.w3c.dom.DOMException
Specified by:
createCDATASection in interface org.w3c.dom.Document
org.w3c.dom.DOMException
See Also:
Document.createCDATASection(java.lang.String)

createProcessingInstruction

public org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target,
                                                                     java.lang.String data)
                                                              throws org.w3c.dom.DOMException
Specified by:
createProcessingInstruction in interface org.w3c.dom.Document
org.w3c.dom.DOMException
See Also:
Document.createProcessingInstruction(java.lang.String, java.lang.String)

createAttribute

public org.w3c.dom.Attr createAttribute(java.lang.String qualifiedName)
                                 throws org.w3c.dom.DOMException
Specified by:
createAttribute in interface org.w3c.dom.Document
org.w3c.dom.DOMException
See Also:
Document.createAttribute(java.lang.String)

createAttributeNS

public org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI,
                                          java.lang.String qualifiedName)
                                   throws org.w3c.dom.DOMException
Specified by:
createAttributeNS in interface org.w3c.dom.Document
org.w3c.dom.DOMException
See Also:
Document.createAttributeNS(java.lang.String, java.lang.String)

createEntityReference

public org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
                                                  throws org.w3c.dom.DOMException
Specified by:
createEntityReference in interface org.w3c.dom.Document
org.w3c.dom.DOMException
See Also:
Document.createEntityReference(java.lang.String)

getElementsByTagName

public org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname)
Specified by:
getElementsByTagName in interface org.w3c.dom.Document
See Also:
Document.getElementsByTagName(java.lang.String)

getElementsByTagNameNS

public org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI,
                                                   java.lang.String localName)
Specified by:
getElementsByTagNameNS in interface org.w3c.dom.Document
See Also:
Document.getElementsByTagNameNS(java.lang.String, java.lang.String)

getElementById

public org.w3c.dom.Element getElementById(java.lang.String elementId)
Specified by:
getElementById in interface org.w3c.dom.Document
See Also:
Document.getElementById(java.lang.String)

getEncoding

public java.lang.String getEncoding()
Description copied from interface: XMLObject
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 XMLObject
Returns:
the encoding or null if no encoding was explicitly specified.
See Also:
org.w3c.dom.Document#getEncoding

setEncoding

public void setEncoding(java.lang.String encoding)
Specified by:
setEncoding in interface XMLObject
See Also:
org.w3c.dom.Document#setEncoding

getStandalone

public boolean getStandalone()
Specified by:
getStandalone in interface XMLObject
See Also:
org.w3c.dom.Document#getStandalone

setStandalone

public void setStandalone(boolean standalone)
Specified by:
setStandalone in interface XMLObject
See Also:
org.w3c.dom.Document#setStandalone

getStrictErrorChecking

public boolean getStrictErrorChecking()
Specified by:
getStrictErrorChecking in interface XMLObject
See Also:
org.w3c.dom.Document#getStrictErrorChecking

setStrictErrorChecking

public void setStrictErrorChecking(boolean strictErrorChecking)
Specified by:
setStrictErrorChecking in interface XMLObject
See Also:
org.w3c.dom.Document#setStrictErrorChecking

getVersion

public java.lang.String getVersion()
Specified by:
getVersion in interface XMLObject
See Also:
org.w3c.dom.Document#getVersion()

setVersion

public void setVersion(java.lang.String version)
Specified by:
setVersion in interface XMLObject
See Also:
org.w3c.dom.Document#setVersion

adoptNode

public org.w3c.dom.Node adoptNode(org.w3c.dom.Node source)
                           throws org.w3c.dom.DOMException
Specified by:
adoptNode in interface XMLObject
org.w3c.dom.DOMException
See Also:
org.w3c.dom.Document#adoptNode

getNodeName

public java.lang.String getNodeName()
Specified by:
getNodeName in interface org.w3c.dom.Node
See Also:
Node.getNodeName()

getNodeValue

public java.lang.String getNodeValue()
                              throws org.w3c.dom.DOMException
Specified by:
getNodeValue in interface org.w3c.dom.Node
org.w3c.dom.DOMException
See Also:
Node.getNodeValue()

setNodeValue

public void setNodeValue(java.lang.String nodeValue)
                  throws org.w3c.dom.DOMException
Specified by:
setNodeValue in interface org.w3c.dom.Node
org.w3c.dom.DOMException
See Also:
Node.setNodeValue(java.lang.String)

getNodeType

public short getNodeType()
Specified by:
getNodeType in interface org.w3c.dom.Node
See Also:
Node.getNodeType()

getParentNode

public org.w3c.dom.Node getParentNode()
Specified by:
getParentNode in interface org.w3c.dom.Node
See Also:
Node.getParentNode()

getChildNodes

public org.w3c.dom.NodeList getChildNodes()
Specified by:
getChildNodes in interface org.w3c.dom.Node
See Also:
Node.getChildNodes()

getFirstChild

public org.w3c.dom.Node getFirstChild()
Specified by:
getFirstChild in interface org.w3c.dom.Node
See Also:
Node.getFirstChild()

getLastChild

public org.w3c.dom.Node getLastChild()
Specified by:
getLastChild in interface org.w3c.dom.Node
See Also:
Node.getLastChild()

getPreviousSibling

public org.w3c.dom.Node getPreviousSibling()
Specified by:
getPreviousSibling in interface org.w3c.dom.Node
See Also:
Node.getPreviousSibling()

getNextSibling

public org.w3c.dom.Node getNextSibling()
Specified by:
getNextSibling in interface org.w3c.dom.Node
See Also:
Node.getNextSibling()

getAttributes

public org.w3c.dom.NamedNodeMap getAttributes()
Specified by:
getAttributes in interface org.w3c.dom.Node
See Also:
Node.getAttributes()

getOwnerDocument

public org.w3c.dom.Document getOwnerDocument()
Specified by:
getOwnerDocument in interface org.w3c.dom.Node
See Also:
Node.getOwnerDocument()

insertBefore

public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node refChild)
                              throws org.w3c.dom.DOMException
Specified by:
insertBefore in interface org.w3c.dom.Node
org.w3c.dom.DOMException
See Also:
Node.insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)

replaceChild

public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node oldChild)
                              throws org.w3c.dom.DOMException
Specified by:
replaceChild in interface org.w3c.dom.Node
org.w3c.dom.DOMException
See Also:
Node.replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)

removeChild

public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
                             throws org.w3c.dom.DOMException
Specified by:
removeChild in interface org.w3c.dom.Node
org.w3c.dom.DOMException
See Also:
Node.removeChild(org.w3c.dom.Node)

appendChild

public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
                             throws org.w3c.dom.DOMException
Specified by:
appendChild in interface org.w3c.dom.Node
org.w3c.dom.DOMException
See Also:
Node.appendChild(org.w3c.dom.Node)

normalize

public void normalize()
Specified by:
normalize in interface org.w3c.dom.Node
See Also:
Node.normalize()

isSupported

public boolean isSupported(java.lang.String feature,
                           java.lang.String version)
Specified by:
isSupported in interface org.w3c.dom.Node
See Also:
Node.isSupported(String, String)

getNamespaceURI

public java.lang.String getNamespaceURI()
Specified by:
getNamespaceURI in interface org.w3c.dom.Node
See Also:
Node.getNamespaceURI()

getPrefix

public java.lang.String getPrefix()
Specified by:
getPrefix in interface org.w3c.dom.Node
See Also:
Node.getPrefix()

setPrefix

public void setPrefix(java.lang.String prefix)
Specified by:
setPrefix in interface org.w3c.dom.Node
See Also:
Node.setPrefix(java.lang.String)

getLocalName

public java.lang.String getLocalName()
Specified by:
getLocalName in interface org.w3c.dom.Node
See Also:
Node.getLocalName()

hasChildNodes

public boolean hasChildNodes()
Specified by:
hasChildNodes in interface org.w3c.dom.Node
See Also:
Node.hasChildNodes()

hasAttributes

public boolean hasAttributes()
Specified by:
hasAttributes in interface org.w3c.dom.Node
See Also:
Node.hasAttributes()

toDocument

public java.lang.String toDocument()
Description copied from interface: XMLObject
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.

Specified by:
toDocument in interface XMLObject
Returns:
A string containing the full XML.
See Also:
XMLObject.toDocument()

syncWithDocument

protected abstract void syncWithDocument(org.w3c.dom.Node node)
Generated function to synchronize the fields used by the access methods. This syncronizes just the node and is not recursive.


syncAccessMethods

public void syncAccessMethods()
Description copied from interface: XMLObject
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.

Specified by:
syncAccessMethods in interface XMLObject
See Also:
XMLObject.syncAccessMethods()

initFields

public void initFields()
Deprecated. Use syncAccessMethods() instead.

Old method to initialize the fields used by the generated access methods from the current state of the document. This method was poorly named and is deprecated.

See Also:
syncAccessMethods

isURLAttribute

public boolean isURLAttribute(org.w3c.dom.Element element,
                              java.lang.String attrName)
Description copied from interface: DocumentInfo
Determine if an attribute of an element can contain a URL.

Specified by:
isURLAttribute in interface DocumentInfo
See Also:
DocumentInfo.isURLAttribute(org.w3c.dom.Element, java.lang.String)

doSetText

protected final void doSetText(org.w3c.dom.Element element,
                               java.lang.String text)
Used internally to implement a setTextXXX() method. Adds check for for null value and helps to minimizes the amount of generated code.



Copyright © 1999-2002 enhydra.org (Mark Diekhans, David Li, Richard Kunze). All Rights reserved.