org.enhydra.xml.xmlc.dom
Class XMLCDocument

java.lang.Object
  |
  +--org.enhydra.xml.xmlc.dom.XMLCDocument

public final class XMLCDocument
extends Object

Class that is a container for the parsed Document DOM. It contains information obtained from that parsers that is not part of the DOM. It also provides various operations on that document.


Constructor Summary
XMLCDocument(XMLCDomFactory domFactory)
          Constructor.
 
Method Summary
 void addIdAttribute(String elementName, String attributeName)
          Define an element id attribute.
 void addPCDataContentElement(String elementName)
          Flag an element as having #PCDATA as part of its content model.
 Document createDocument(String namespaceURI, String qualifiedName)
          Create the document.
 DocumentType createDocumentType(String qualifiedName, String publicID, String systemID, String internalSubset)
          Creates an empty DocumentType node.
 Document getDocument()
          Get the document associated with this object.
 XMLCDomFactory getDomFactory()
          Get the DOM factory associated with this object.
 String[] getElementClassNames(Element element)
          Extract the class names for an element.
 String getElementId(Element element)
          Extract the unique id for an element object.
 String getElementName(Element element)
          Extract the name for an element.
 String getEncoding()
           
 String getGlobalIdAttribute()
          Get the global id attribute name.
 String getIdAttrName(Element element)
          Get the id attribute name for an element.
 String getXMLVersion()
          Get the XML version.
 boolean hasPCDataInContentModel(Element element)
          Check if an element has #PCDATA as part of it's content model.
 boolean isHtmlDocument()
           
 boolean isHtmlFrameSet()
          Is the document as a HTML frameset?
 boolean isURLAttribute(Element element, String attrName)
          Determine if an an attribute of an element may contain a URL.
 String nodeClassToInterface(Node node)
          Convert an implementation-specific DOM node class name to the external interface or class name.
 void setEncoding(String encoding)
           
 void setIsHtmlFrameSet()
          Flat the document as a HTML frameset.
 void setXMLVersion(String xmlVersion)
          Set the XML version.
 String toDocument()
          Convert the document to a string representation of the document.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLCDocument

public XMLCDocument(XMLCDomFactory domFactory)
             throws XMLCException
Constructor. A document is not initially associated with this object.
Parameters:
domFactory - The DOM factory to create and get information about DOMs.
isHtmlDocument - Is this an HTML document?
Method Detail

getDomFactory

public XMLCDomFactory getDomFactory()
Get the DOM factory associated with this object.

createDocumentType

public DocumentType createDocumentType(String qualifiedName,
                                       String publicID,
                                       String systemID,
                                       String internalSubset)
Creates an empty DocumentType node.

createDocument

public Document createDocument(String namespaceURI,
                               String qualifiedName)
Create the document. All arguments are null for HTML.

getDocument

public Document getDocument()
Get the document associated with this object.

isHtmlDocument

public boolean isHtmlDocument()

isHtmlFrameSet

public boolean isHtmlFrameSet()
Is the document as a HTML frameset?

setIsHtmlFrameSet

public void setIsHtmlFrameSet()
Flat the document as a HTML frameset.

setXMLVersion

public void setXMLVersion(String xmlVersion)
Set the XML version.
Parameters:
xmlVersion - XML version string.

getXMLVersion

public String getXMLVersion()
Get the XML version.

getEncoding

public String getEncoding()

setEncoding

public void setEncoding(String encoding)

addPCDataContentElement

public void addPCDataContentElement(String elementName)
Flag an element as having #PCDATA as part of its content model.
Parameters:
elementName - The name of the element.

addIdAttribute

public void addIdAttribute(String elementName,
                           String attributeName)
Define an element id attribute. For XML, all ID attributes must be defined, even if not used. This is need to make global id attribute mode work.
Parameters:
elementName - The name of the element.
attributeName - The name of the ID attribute.

nodeClassToInterface

public String nodeClassToInterface(Node node)
Convert an implementation-specific DOM node class name to the external interface or class name.
See Also:
XMLCDomFactory

getGlobalIdAttribute

public String getGlobalIdAttribute()
Get the global id attribute name. A DTD supports global id mode if a single attribute name is used for all elements that support ids and never used as a non-id attribute name. This is intended for the HTML `id' attribute. However, if a DTD conforms to this requirement, more efficient code for cloning the object can be generated. It has been suggested that `id' be a defacto standard for XML as well. This method will not be called until after the DTD has been parsed, so this can be determined. See the XML Annotated Specification.
Returns:
The global id attribute name or null if there is not a global ID attribute.

getIdAttrName

public String getIdAttrName(Element element)
Get the id attribute name for an element. The attribute doesn't need to actually exist in this element, this just gets the name for the attribute.
Returns:
The attribute name or null if the element does not have an id attribute.

getElementId

public String getElementId(Element element)
Extract the unique id for an element object. This is specified with an attribute of type ID.
Returns:
The id or null if the element does not have an id.

getElementClassNames

public String[] getElementClassNames(Element element)
Extract the class names for an element.
See Also:
XMLCDomFactory.getElementClassNames(org.w3c.dom.Element)

getElementName

public String getElementName(Element element)
Extract the name for an element. This is a non-unique name for an element. In HTML, the name is specified with the name attribute. It's not supported for XML.
Returns:
The element name or null if the node has no name. XML returns null.

isURLAttribute

public boolean isURLAttribute(Element element,
                              String attrName)
Determine if an an attribute of an element may contain a URL.
See Also:
XMLCDomFactory.isURLAttribute(org.w3c.dom.Element, java.lang.String)

hasPCDataInContentModel

public boolean hasPCDataInContentModel(Element element)
Check if an element has #PCDATA as part of it's content model.

toDocument

public String toDocument()
Convert the document to a string representation of the document. The results are parsable into the same DOM hierarchy


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