Enhydra 3.0.3 API

org.enhydra.xml.xmlc.dom
Interface XMLCDomFactory

All Known Implementing Classes:
DefaultXMLDomFactory, org.enhydra.xml.xmlc.dom.xerces.XercesDomFactory, DefaultHTMLDomFactory

public interface XMLCDomFactory

Interface for a factory class that can create DocumentType and Document objects. It also provides document-type specific functions.

Classes implementing this must:

When a DTD-specific DOM is created, an class implementing this interface must be supplied to XMLC. This would normally be created by extending the XMLCDomDefaultFactory class.


Method Summary
 Document createDocument(java.lang.String qualifiedName, DocumentType doctype)
          Creates an XML Document object of the specified type with its document element.
 DocumentType createDocumentType(java.lang.String qualifiedName, java.lang.String publicID, java.lang.String systemID, java.lang.String internalSubset)
          Creates an empty DocumentType node.
 java.lang.String getBaseClassName()
          Get the base class name for generated classes.
 java.lang.String getBaseInterfaceName()
          Get the base interface name for generated interfaces.
 java.lang.String[] getElementClassNames(Element element)
          Extract the class names for an element.
 java.lang.String[] getElementURLAttrs(Element element)
          Get a list of attribute names for an element who's value can be a URL.
 boolean needsCreateTextSetMethod(Element element)
          Determine if this element should have an set method created for it's first text child.
 java.lang.String nodeClassToInterface(Node node)
          Convert an implementation-specific DOM node class name to the external interface or class name that should be used to reference it.
 void setErrorChecking(Document doc, boolean check)
          Enable or disable optional DOM error checking.
 

Method Detail

createDocumentType

public DocumentType createDocumentType(java.lang.String qualifiedName,
                                       java.lang.String publicID,
                                       java.lang.String systemID,
                                       java.lang.String internalSubset)
Creates an empty DocumentType node.
Parameters:
qualifiedName - The document type name (same as the root element).
publicID - The document type public identifier.
systemID - The document type system identifier.
internalSubset - The internal subset as a string.
Returns:
A new DocumentType node with Node.ownerDocument set to null. For HTML DOM factories, this returns null.

createDocument

public Document createDocument(java.lang.String qualifiedName,
                               DocumentType doctype)
Creates an XML Document object of the specified type with its document element.
Parameters:
qualifiedName - The document type name (same as the root element). Maybe null for HTML documents.
doctype - The type of document to be created or null. When doctype is not null, its Node.ownerDocument attribute is set to the document being created. Maybe null for for documents without DTDs or HTML documents.
Returns:
A new Document object.

setErrorChecking

public void setErrorChecking(Document doc,
                             boolean check)
Enable or disable optional DOM error checking. DOM implementations (like Xerces) may allow some error checking to be disabled to improve performance. If possible, this enables or disables error checking. If the DOM does not support optional error checking, this does nothing.

Note: as a short-term performance enhancement, this also enables/disables DOM level 2 mutation events. Don't count on this functionality in future releases.

Parameters:
doc - the document to operate on.
check - true to enable error checking, false to disable it.

getBaseClassName

public java.lang.String getBaseClassName()
Get the base class name for generated classes. It must extend XMLObjectImpl. This class maybe overridden for individual documents that are compiled.

getBaseInterfaceName

public java.lang.String getBaseInterfaceName()
Get the base interface name for generated interfaces. It must extend XMLObject. This class maybe overridden for individual documents that are compiled.

nodeClassToInterface

public java.lang.String nodeClassToInterface(Node node)
Convert an implementation-specific DOM node class name to the external interface or class name that should be used to reference it. This could be a org.w3c.dom interface or other interface or class.
See Also:
org.enhydra.xml.xmlc

getElementClassNames

public java.lang.String[] getElementClassNames(Element element)
Extract the class names for an element. This is a class for grouping elements, not the Java class. In HTML, the class is specified with the class attribute and with a value of a white-space separated list of class names. Its not specified for XML, however this method can be implemented in DTD-specifc XMLDomFactories to enable this functionality.
Returns:
An array of class names or null if the node has no classes. XML returns null.

getElementURLAttrs

public java.lang.String[] getElementURLAttrs(Element element)
Get a list of attribute names for an element who's value can be a URL. This is use when mapping URL values. The return list does not need to be restricted to attributes that are legal for the element. The list can be all attributes in the DTD that can have URLs if element context doesn't matter. The attributes return should have values of type %URL, %URI or %Script.
Returns:
A list of attribute names or null if none of the attributes. The returned array will not be modified.

needsCreateTextSetMethod

public boolean needsCreateTextSetMethod(Element element)
Determine if this element should have an set method created for it's first text child.

Enhydra 3.0.3 API