org.enhydra.xml.xmlc
Class XMLObjectImpl

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

public abstract class XMLObjectImpl
extends Object
implements XMLObject, Document, DocumentInfo

Base class for all compiled XML objects.

See Also:
XMLObject

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_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
protected XMLObjectImpl()
          Constructor.
 
Method Summary
 Node adoptNode(Node source)
          See org.w3c.dom.Document#adoptNode
 Node appendChild(Node newChild)
           
protected  void cloneDeepCheck(boolean deep)
          Check that cloneNode on an entire document is done with the deep option.
abstract  Node cloneNode(boolean deep)
          Clone the entire document.
 short compareDocumentPosition(Node arg0)
           
 Attr createAttribute(String qualifiedName)
           
 Attr createAttributeNS(String namespaceURI, String qualifiedName)
           
 CDATASection createCDATASection(String data)
           
 Comment createComment(String data)
           
 DocumentFragment createDocumentFragment()
           
 Element createElement(String tagName)
           
 Element createElementNS(String namespaceURI, String qualifiedName)
           
 EntityReference createEntityReference(String name)
           
 ProcessingInstruction createProcessingInstruction(String target, String data)
           
 Text createTextNode(String data)
           
protected  void doSetText(Element element, String text)
          Used internally to implement a setTextXXX() method.
 NamedNodeMap getAttributes()
           
 String getBaseURI()
           
 NodeList getChildNodes()
           
 XMLObject getDelegate()
          Get the delegate.
 DocumentType getDoctype()
           
 Document getDocument()
          Get the actual document object.
 Element getDocumentElement()
           
 String getDocumentURI()
           
 DOMConfiguration getDomConfig()
           
protected abstract  XMLCDomFactory getDomFactory()
          Get the XMLC DOM Factory associated with this document type and DOM implementation.
 Element getElementById(String elementId)
           
 NodeList getElementsByTagName(String tagname)
           
 NodeList getElementsByTagNameNS(String namespaceURI, String localName)
           
 String getEncoding()
          See org.w3c.dom.Document#getEncoding
 Object getFeature(String arg0, String arg1)
           
 Node getFirstChild()
           
 DOMImplementation getImplementation()
           
 String getInputEncoding()
           
 Node getLastChild()
           
 String getLocalName()
           
 String getMIMEType()
          Get the MIME type associated with the document, or null if none was associated.
 String getNamespaceURI()
           
 Node getNextSibling()
           
 String getNodeName()
           
 short getNodeType()
           
 String getNodeValue()
           
 Document getOwnerDocument()
           
 Node getParentNode()
           
 String getPrefix()
           
 Node getPreviousSibling()
           
 boolean getStandalone()
          See org.w3c.dom.Document#getStandalone
 boolean getStrictErrorChecking()
          See org.w3c.dom.Document#getStrictErrorChecking
 String getTextContent()
           
 Object getUserData(String arg0)
           
 String getVersion()
          See org.w3c.dom.Document#getVersion()
 String getXmlEncoding()
           
 boolean getXmlStandalone()
           
 String getXmlVersion()
           
 boolean hasAttributes()
           
 boolean hasChildNodes()
           
 Node importNode(Node importedNode, boolean deep)
           
 void initFields()
          Deprecated. Use syncAccessMethods() instead.
 Node insertBefore(Node newChild, Node refChild)
           
 boolean isDefaultNamespace(String arg0)
           
 boolean isEqualNode(Node arg0)
           
 boolean isSameNode(Node arg0)
           
 boolean isSupported(String feature, String version)
           
 boolean isURLAttribute(Element element, String attrName)
          Determine if an attribute of an element can contain a URL.
 String lookupNamespaceURI(String arg0)
           
 String lookupPrefix(String arg0)
           
 void normalize()
           
 void normalizeDocument()
           
 Node removeChild(Node oldChild)
           
 Node renameNode(Node arg0, String arg1, String arg2)
           
 Node replaceChild(Node newChild, Node oldChild)
           
 void setDelegate(XMLObject delegate)
          Set the delegate object.
protected  void setDocument(Document document, String mimeType, String encoding)
          Set the DOM document associated with this object and optional encoding.
 void setDocumentURI(String arg0)
           
 void setEncoding(String encoding)
          See org.w3c.dom.Document#setEncoding
 void setNodeValue(String nodeValue)
           
 void setPrefix(String prefix)
           
 void setStandalone(boolean standalone)
          See org.w3c.dom.Document#setStandalone
 void setStrictErrorChecking(boolean strictErrorChecking)
          See org.w3c.dom.Document#setStrictErrorChecking
 void setTextContent(String arg0)
           
 Object setUserData(String arg0, Object arg1, UserDataHandler arg2)
           
 void setVersion(String version)
          See org.w3c.dom.Document#setVersion
 void setXmlStandalone(boolean arg0)
           
 void setXmlVersion(String arg0)
           
 void syncAccessMethods()
          Initialize the fields used by the generated access methods from the current state of the document.
protected abstract  void syncWithDocument(Node node)
          Generated function to synchronize the fields used by the access methods.
 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(Document document,
                           String mimeType,
                           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 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 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
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
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 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 Node
See Also:
Node.cloneNode(boolean)

getDoctype

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

getImplementation

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

getDocumentElement

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

importNode

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

createElement

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

createElementNS

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

createDocumentFragment

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

createTextNode

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

createComment

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

createCDATASection

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

createProcessingInstruction

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

createAttribute

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

createAttributeNS

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

createEntityReference

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

getElementsByTagName

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

getElementsByTagNameNS

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

getElementById

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

getEncoding

public String getEncoding()
See org.w3c.dom.Document#getEncoding
Specified by:
getEncoding in interface XMLObject
Following copied from interface: org.enhydra.xml.xmlc.XMLObject
Returns:
the encoding or null if no encoding was explicitly specified.
See Also:
DOMFormatter, OutputOptions

setEncoding

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

getStandalone

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

setStandalone

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

getStrictErrorChecking

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

setStrictErrorChecking

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

getVersion

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

setVersion

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

adoptNode

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

getNodeName

public String getNodeName()
Specified by:
getNodeName in interface Node
See Also:
Node.getNodeName()

getNodeValue

public String getNodeValue()
                    throws DOMException
Specified by:
getNodeValue in interface Node
See Also:
Node.getNodeValue()

setNodeValue

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

getNodeType

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

getParentNode

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

getChildNodes

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

getFirstChild

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

getLastChild

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

getPreviousSibling

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

getNextSibling

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

getAttributes

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

getOwnerDocument

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

insertBefore

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

replaceChild

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

removeChild

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

appendChild

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

normalize

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

isSupported

public boolean isSupported(String feature,
                           String version)
Specified by:
isSupported in interface Node
See Also:
Node.isSupported(String, String)

getNamespaceURI

public String getNamespaceURI()
Specified by:
getNamespaceURI in interface Node
See Also:
Node.getNamespaceURI()

getPrefix

public String getPrefix()
Specified by:
getPrefix in interface Node
See Also:
Node.getPrefix()

setPrefix

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

getLocalName

public String getLocalName()
Specified by:
getLocalName in interface Node
See Also:
Node.getLocalName()

hasChildNodes

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

hasAttributes

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

toDocument

public 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
See Also:
XMLObject.toDocument()

syncWithDocument

protected abstract void syncWithDocument(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(Element element,
                              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(Element element,
                               String text)
Used internally to implement a setTextXXX() method. Adds check for for null value and helps to minimizes the amount of generated code.

getDocumentURI

public String getDocumentURI()
Specified by:
getDocumentURI in interface Document

getDomConfig

public DOMConfiguration getDomConfig()
Specified by:
getDomConfig in interface Document

getInputEncoding

public String getInputEncoding()
Specified by:
getInputEncoding in interface Document

getXmlEncoding

public String getXmlEncoding()
Specified by:
getXmlEncoding in interface Document

getXmlStandalone

public boolean getXmlStandalone()
Specified by:
getXmlStandalone in interface Document

getXmlVersion

public String getXmlVersion()
Specified by:
getXmlVersion in interface Document

normalizeDocument

public void normalizeDocument()
Specified by:
normalizeDocument in interface Document

renameNode

public Node renameNode(Node arg0,
                       String arg1,
                       String arg2)
                throws DOMException
Specified by:
renameNode in interface Document

setDocumentURI

public void setDocumentURI(String arg0)
Specified by:
setDocumentURI in interface Document

setXmlStandalone

public void setXmlStandalone(boolean arg0)
                      throws DOMException
Specified by:
setXmlStandalone in interface Document

setXmlVersion

public void setXmlVersion(String arg0)
                   throws DOMException
Specified by:
setXmlVersion in interface Document

compareDocumentPosition

public short compareDocumentPosition(Node arg0)
                              throws DOMException
Specified by:
compareDocumentPosition in interface Node

getBaseURI

public String getBaseURI()
Specified by:
getBaseURI in interface Node

getFeature

public Object getFeature(String arg0,
                         String arg1)
Specified by:
getFeature in interface Node

getTextContent

public String getTextContent()
                      throws DOMException
Specified by:
getTextContent in interface Node

getUserData

public Object getUserData(String arg0)
Specified by:
getUserData in interface Node

isDefaultNamespace

public boolean isDefaultNamespace(String arg0)
Specified by:
isDefaultNamespace in interface Node

isEqualNode

public boolean isEqualNode(Node arg0)
Specified by:
isEqualNode in interface Node

isSameNode

public boolean isSameNode(Node arg0)
Specified by:
isSameNode in interface Node

lookupNamespaceURI

public String lookupNamespaceURI(String arg0)
Specified by:
lookupNamespaceURI in interface Node

lookupPrefix

public String lookupPrefix(String arg0)
Specified by:
lookupPrefix in interface Node

setTextContent

public void setTextContent(String arg0)
                    throws DOMException
Specified by:
setTextContent in interface Node

setUserData

public Object setUserData(String arg0,
                          Object arg1,
                          UserDataHandler arg2)
Specified by:
setUserData in interface Node


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