Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.enhydra.xml.xmlc.dom
Class XMLCDocument  view XMLCDocument download XMLCDocument.java

java.lang.Object
  extended byorg.enhydra.xml.xmlc.dom.XMLCDocument

public final class XMLCDocument
extends java.lang.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.


Field Summary
private  org.w3c.dom.Element fDocElement
          The document element.
private  org.w3c.dom.DocumentType fDocType
          The DOM Document type (null for HTML).
private  org.w3c.dom.Document fDocument
          The DOM Document.
private  XMLCDomFactory fDomFactory
          The DTD-specific DOM Factory.
private  java.util.TreeMap fElementIdAttrs
          Table of element to id attribute name mappings.
private  java.lang.String fEncoding
           
private  java.util.TreeSet fIdAttrNames
          Table of id attribute names.
private  boolean fIsHtmlDocument
          Is this an HTML document we are dealing with?
private  boolean fIsHtmlFrameSet
          Is this a HTML frameset?
private  java.lang.String fLastIdAttrName
          Last id attribute name; provides easy access to fIdAttrNames when there is only one.
private  java.util.TreeSet fPCDataElements
          Table of elements that can have PCDATA children.
private  java.lang.String fXMLVersion
          Information from XML header.
 
Constructor Summary
XMLCDocument(XMLCDomFactory domFactory)
          Constructor.
 
Method Summary
 void addIdAttribute(java.lang.String elementName, java.lang.String attributeName)
          Define an element id attribute.
 void addPCDataContentElement(java.lang.String elementName)
          Flag an element as having #PCDATA as part of its content model.
 org.w3c.dom.Document createDocument(java.lang.String namespaceURI, java.lang.String qualifiedName)
          Create the document.
 org.w3c.dom.DocumentType createDocumentType(java.lang.String qualifiedName, java.lang.String publicID, java.lang.String systemID, java.lang.String internalSubset)
          Creates an empty DocumentType node.
 org.w3c.dom.Document getDocument()
          Get the document associated with this object.
 XMLCDomFactory getDomFactory()
          Get the DOM factory associated with this object.
 java.lang.String[] getElementClassNames(org.w3c.dom.Element element)
          Extract the class names for an element.
 java.lang.String getElementId(org.w3c.dom.Element element)
          Extract the unique id for an element object.
 java.lang.String getElementName(org.w3c.dom.Element element)
          Extract the name for an element.
 java.lang.String getEncoding()
           
 java.lang.String getGlobalIdAttribute()
          Get the global id attribute name.
 java.lang.String getIdAttrName(org.w3c.dom.Element element)
          Get the id attribute name for an element.
 java.lang.String getXMLVersion()
          Get the XML version.
 boolean hasPCDataInContentModel(org.w3c.dom.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 isPreCreatedNode(org.w3c.dom.Node node)
          Determine if a node is one that existed we a document was newly created.
 boolean isURLAttribute(org.w3c.dom.Element element, java.lang.String attrName)
          Determine if an an attribute of an element may contain a URL.
 java.lang.String nodeClassToInterface(org.w3c.dom.Node node)
          Convert an implementation-specific DOM node class name to the external interface or class name.
 void setEncoding(java.lang.String encoding)
           
 void setIsHtmlFrameSet()
          Flat the document as a HTML frameset.
 void setXMLVersion(java.lang.String xmlVersion)
          Set the XML version.
 java.lang.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
 

Field Detail

fDomFactory

private XMLCDomFactory fDomFactory
The DTD-specific DOM Factory.


fIsHtmlDocument

private boolean fIsHtmlDocument
Is this an HTML document we are dealing with?


fIsHtmlFrameSet

private boolean fIsHtmlFrameSet
Is this a HTML frameset?


fXMLVersion

private java.lang.String fXMLVersion
Information from XML header.


fEncoding

private java.lang.String fEncoding

fDocument

private org.w3c.dom.Document fDocument
The DOM Document.


fDocType

private org.w3c.dom.DocumentType fDocType
The DOM Document type (null for HTML).


fDocElement

private org.w3c.dom.Element fDocElement
The document element.


fElementIdAttrs

private java.util.TreeMap fElementIdAttrs
Table of element to id attribute name mappings.


fIdAttrNames

private java.util.TreeSet fIdAttrNames
Table of id attribute names.


fLastIdAttrName

private java.lang.String fLastIdAttrName
Last id attribute name; provides easy access to fIdAttrNames when there is only one.


fPCDataElements

private java.util.TreeSet fPCDataElements
Table of elements that can have PCDATA children.

Constructor Detail

XMLCDocument

public XMLCDocument(XMLCDomFactory domFactory)
             throws org.enhydra.xml.xmlc.XMLCException
Constructor. A document is not initially associated with this object.

Method Detail

getDomFactory

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


createDocumentType

public org.w3c.dom.DocumentType createDocumentType(java.lang.String qualifiedName,
                                                   java.lang.String publicID,
                                                   java.lang.String systemID,
                                                   java.lang.String internalSubset)
Creates an empty DocumentType node.


createDocument

public org.w3c.dom.Document createDocument(java.lang.String namespaceURI,
                                           java.lang.String qualifiedName)
Create the document. All arguments are null for HTML.


getDocument

public org.w3c.dom.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(java.lang.String xmlVersion)
Set the XML version.


getXMLVersion

public java.lang.String getXMLVersion()
Get the XML version.


getEncoding

public java.lang.String getEncoding()

setEncoding

public void setEncoding(java.lang.String encoding)

isPreCreatedNode

public boolean isPreCreatedNode(org.w3c.dom.Node node)
Determine if a node is one that existed we a document was newly created.


addPCDataContentElement

public void addPCDataContentElement(java.lang.String elementName)
Flag an element as having #PCDATA as part of its content model.


addIdAttribute

public void addIdAttribute(java.lang.String elementName,
                           java.lang.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.


nodeClassToInterface

public java.lang.String nodeClassToInterface(org.w3c.dom.Node node)
Convert an implementation-specific DOM node class name to the external interface or class name.


getGlobalIdAttribute

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


getIdAttrName

public java.lang.String getIdAttrName(org.w3c.dom.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.


getElementId

public java.lang.String getElementId(org.w3c.dom.Element element)
Extract the unique id for an element object. This is specified with an attribute of type ID.


getElementClassNames

public java.lang.String[] getElementClassNames(org.w3c.dom.Element element)
Extract the class names for an element.


getElementName

public java.lang.String getElementName(org.w3c.dom.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.


isURLAttribute

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


hasPCDataInContentModel

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


toDocument

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