org.enhydra.xml.xmlc.dom
Interface XMLCDomFactory

All Known Implementing Classes:
XercesDomFactory, LazyDomFactory, LazyHTMLDomFactory, XercesHTMLDomFactory

public interface XMLCDomFactory

Interface for a factory class that can create DocumentType and Document objects. It also provides document-type specific functions. This is used in implementing subclassed DOMs.

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.

This class is designed to be build using a DOMImplementation object. However, since the DOM doesn't specify how DOMImplementation objects are obtained, we hide that detail. The methods are somewhat different for historic reasons.

See Also:
DOMImplementation, HTMLDOMImplementation

Method Summary
 Document createDocument(String namespaceURI, String qualifiedName, DocumentType doctype)
          Creates an XML Document object of the specified type.
 DocumentType createDocumentType(String qualifiedName, String publicID, String systemID, String internalSubset)
          Creates an empty DocumentType node.
 String getBaseClassName()
          Get the base class name for generated classes.
 String getDocumentClassName()
          Get the FQCN of the Document class for the current DOM Implementation
 String[] getElementClassNames(Element element)
          Extract the class names for an element.
 String[] getInterfaceNames()
          Get the interface names that will automatically be added to all generated classes and interfaces.
 String getMIMEType()
          Get the MIME type to associated with the document, or null if none should be associated.
 boolean isURLAttribute(Element element, String attrName)
          Determine if an an attribute of an element may contain a URL and should be subject to URL editing at compile time(or rewriting at run time.
 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.
 

Method Detail

createDocumentType

public DocumentType createDocumentType(String qualifiedName,
                                       String publicID,
                                       String systemID,
                                       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.

createDocument

public Document createDocument(String namespaceURI,
                               String qualifiedName,
                               DocumentType doctype)
Creates an XML Document object of the specified type. The document element should be created. A HTML document should only have the document element, which differs from the DOMImplementation specification, however it makes code generation easier and its not expected that there will be many custom HTML DOM factories.
Parameters:
namespaceURI - The namespace URI of the document element to create, or null.
qualifiedName - The document type name (same as the root element). Maybe null for HTML documents or documents without DTDs.
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.
See Also:
DOMImplementation, HTMLDOMImplementation

getDocumentClassName

public String getDocumentClassName()
Get the FQCN of the Document class for the current DOM Implementation

getMIMEType

public String getMIMEType()
Get the MIME type to associated with the document, or null if none should be associated.

getBaseClassName

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

getInterfaceNames

public String[] getInterfaceNames()
Get the interface names that will automatically be added to all generated classes and interfaces. This class maybe overridden for individual documents that are compiled. It XMLObject is not part of the list, it will be added automatically.
Returns:
An array of fully-qualified interface names, or null if none, other than XMLObject, are to be added.

nodeClassToInterface

public 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 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.

isURLAttribute

public boolean isURLAttribute(Element element,
                              String attrName)
Determine if an an attribute of an element may contain a URL and should be subject to URL editing at compile time(or rewriting at run time. This method is required, as there is not way to define this in a XML DTD. With HTML, the attributes returned should have values of type %URL, %URI or %Script.
Parameters:
element - The element object the attribute is associated with.
attrName - The name of the attribute.
Returns:
True if the attribute may contain a URL (although it could contain JavaScript, etc. False if it can't and shouldn't be edited.


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