XML for Java Compatibility API 2.0.6

com.ibm.xml.parser
Class TXDocument

java.lang.Object
  |
  +--com.ibm.xml.parser.Child
        |
        +--com.ibm.xml.parser.Parent
              |
              +--com.ibm.xml.parser.TXDocument
Direct Known Subclasses:
TreeFactory

public class TXDocument
extends Parent
implements org.w3c.dom.Document

The TXDocument class implements the Document interface as defined by the Document Object Model (DOM).

The Document object represents the entire XML document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data.

Version:
Revision: 01 1.7 src/com/ibm/xml/parser/TXDocument.java, parser, xml4j2, xml4j2_0_6
See Also:
Document, Parent, Child, Parser.setElementFactory(com.ibm.xml.parser.TXDocument), Serialized Form

Field Summary
 java.lang.String expandedNameSeparator
           
 
Fields inherited from class com.ibm.xml.parser.Child
ATTDEF, ATTLIST, ELEMENT_DECL, NAME_ATTDEF, NAME_ATTLIST, NAME_CDATA, NAME_COMMENT, NAME_DOCFRAGMENT, NAME_DOCUMENT, NAME_ELEMENT_DECL, NAME_PSEUDONODE, NAME_TEXT, PSEUDONODE
 
Constructor Summary
TXDocument()
          Constructor.
 
Method Summary
 void acceptPost(Visitor visitor)
          Implements the accept operation of the visitor design pattern when the end of a TXDocument Node is recognized when traversing the document object tree.
 void acceptPre(Visitor visitor)
          Implements the accept operation of the visitor design pattern when the start of a TXDocument Node is recognized when traversing the document object tree.
protected  void checkChildType(org.w3c.dom.Node child)
          Check whether child is allowed to be insered in this node or not.
 java.lang.Object clone()
          Clone this Document Node and its children using the appropriate factories.
 org.w3c.dom.Node cloneNode(boolean deep)
           
 AttDef createAttDef(java.lang.String name)
          Create and initialize a AttDef instance using the supplied parameters.
 Attlist createAttlist(java.lang.String name)
          Create and initialize a Attlist instance using the supplied parameters.
 org.w3c.dom.Attr createAttribute(java.lang.String name)
          Create and return a new Attr.
 org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
          Create and initialize a TXCDATASection instance using the supplied parameters.
 org.w3c.dom.Comment createComment(java.lang.String data)
          Create and initialize a TXComment instance using the supplied parameters.
 ContentModel createContentModel(CMNode modelGroupNode)
          Create and initialize a ContentModel instance using the supplied parameters.
 ContentModel createContentModel(int type)
          Create and initialize a ContentModel instance using the supplied parameters.
 org.w3c.dom.DocumentFragment createDocumentFragment()
          This method is defined by DOM.
 DTD createDTD()
          Create and initialize a DTD instance.
 DTD createDTD(java.lang.String name, ExternalID externalID)
          Create and initialize a DTD instance using the supplied parameters.
 org.w3c.dom.Element createElement(java.lang.String name)
          Create and initialize a TXElement instance using the supplied parameters.
 ElementDecl createElementDecl(java.lang.String name, ContentModel contentModel)
          Create and initialize a ElementDecl instance using the supplied parameters.
 org.w3c.dom.Entity createEntity()
          This method is defined by DOM.
 EntityDecl createEntityDecl(java.lang.String name, ExternalID externalID, boolean isParameter, java.lang.String ndata)
          Create and initialize a EntityDecl instance using the supplied parameters.
 EntityDecl createEntityDecl(java.lang.String name, java.lang.String value, boolean isParameter)
          Create and initialize a EntityDecl instance using the supplied parameters.
 org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
          Create and initialize a EntityReference instance using the supplied parameters.
 java.security.MessageDigest createMessageDigest()
          Returns a newly created MessageDigest instance if none currently exists, or resets the existing digest.
 TXNotation createNotation(java.lang.String name, ExternalID externalID)
          Create and initialize a TXNotation instance using the supplied parameters.
 org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String name, java.lang.String data)
          Create and initialize a TXPI instance using the supplied parameters.
 StylesheetPI createStylesheetPI(java.lang.String name, java.lang.String data, java.lang.String type, java.lang.String hrefURI, java.lang.String title)
          Create and initialize a StylesheetPI instance using the supplied parameters.
 TXText createTextNode(char[] charArray, int offset, int length, boolean isIgnorableWhitespace)
          Create and initialize a TXText instance using the supplied parameters.
 org.w3c.dom.Text createTextNode(java.lang.String data)
          Create and initialize a TXText instance using the supplied parameters.
 TXText createTextNode(java.lang.String data, boolean isIgnorableWhitespace)
          Create and initialize a TXText instance using the supplied parameters.
 boolean equals(org.w3c.dom.Node arg, boolean deep)
           
 org.w3c.dom.DocumentType getDoctype()
          Returns this Document's Type Definition (DTD) as a Node.
 org.w3c.dom.Element getDocumentElement()
          Returns this Document's root Element.
 DTD getDTD()
          Returns this Document's Type Definition (DTD) as a DTD.
 org.w3c.dom.NodeList getElementsByTagName(java.lang.String qName)
          Returns a NodeList of matches through all child Element Nodes.
 java.lang.String getEncoding()
          Returns the value of the XML encoding parameter from the XML prolog declaration (e.g.
 TXDocument getFactory()
           
 org.w3c.dom.DOMImplementation getImplementation()
          Return an instance of DOMImplementation handling this document.
static TXDocument getInstance()
          Returns the current TXDocument instance; if an instance does not currently exist, it will be created.
 java.lang.String getNodeName()
           
 short getNodeType()
          Returns that this object is a Document Node.
 org.w3c.dom.Document getOwnerDocument()
          Returns null.
 java.lang.String getRootName()
          Returns the name of this Document's root Element (not DTD).
 java.lang.String getStandalone()
          Returns if this Document is standalone.
 java.lang.String getText()
          Return all text associated with this Node and its children without considering entities.
 java.lang.String getVersion()
          Returns the XML version of this Document from the XML prolog declaration (e.g.
 boolean isAddFixedAttributes()
          Returns a flag whether #FIXED attributes are automatically added.
 boolean isCheckNodeLoop()
          Returns a flag whether new child is an ancestor of a parent.
 boolean isCheckOwnerDocument()
          Returns a flag whether new child was created from another document.
 boolean isCheckValidity()
          Returns whether validity constraints are checked in this doument.
 boolean isProcessNamespace()
          Returns whether namespaces are considered.
 boolean isStandalone()
          Returns if this Document is standalone.
 void printWithFormat(java.io.Writer pw)
          Format and print this Node and any children in XML format using the default character encoding.
 void printWithFormat(java.io.Writer pw, java.lang.String encoding)
          Format and print this Node and any children in XML format using the specified character encoding.
 void printWithFormat(java.io.Writer pw, java.lang.String encoding, int indent)
          Format and print this Node and any children in XML format, using the specified character encoding, and indented by indent spaces.
protected  void realInsert(org.w3c.dom.Node child, int index)
          Insert a Child Node into the specified position.
 org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
          Removes the Child Node indicated by oldChild from this Nodes list of children, and returns it.
 org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)
          Replaces the Child Node oldChild with newChild in this Node's list of children, and return the oldChild Node.
protected  void resetCheckValidity()
          Reconfigure checkValidity flag.
 void setAddFixedAttributes(boolean addFixedAttributes)
          Sets a flag whether #FIXED attributes are automatically added.
 void setCheckNodeLoop(boolean doCheck)
          Sets a flag whether new child is an ancestor of a parent.
 void setCheckOwnerDocument(boolean doCheck)
          Sets a flag whether new child was created from another document.
 void setDigestAlgorithm(java.lang.String defDigestAlgorithm)
          Sets the default message digest algorithm for use by createMessageDigest().
 void setEncoding(java.lang.String xmlEncoding)
          Sets the value of the XML encoding parameter from the XML prolog declaration (e.g.
 void setPrintInternalDTD(boolean printInternalDTD)
          Sets whether the internal DTD is printed by the print() methods.
 void setProcessNamespace(boolean isProcessNamespace)
          Sets whether namespaces are considered in some operations to nodes created by this document.
 void setStandalone(java.lang.String standalone)
          Sets if this Document is standalone.
 void setVersion(java.lang.String xmlVersion)
          Sets the XML version of this Document from the XML prolog declaration (e.g.
 
Methods inherited from class com.ibm.xml.parser.Parent
addElement, appendChild, elements, expandEntityReferences, getChildNodes, getChildrenArray, getFirstChild, getFirstWithoutReference, getLastChild, getLastWithoutReference, hasChildNodes, insert, insertAfter, insertBefore, insertFirst, insertLast, processAfterRemove
 
Methods inherited from class com.ibm.xml.parser.Child
clearDigest, getAttributes, getDigest, getNextSibling, getNextWithoutReference, getNodeValue, getParentNode, getParentWithoutReference, getPreviousSibling, getPreviousWithoutReference, getUserData, makeXPointer, print, print, searchAncestors, searchAncestors, setFactory, setNodeValue, setUserData, toXMLString, toXMLString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

expandedNameSeparator

public java.lang.String expandedNameSeparator
See Also:
Namespace.createExpandedName()
Constructor Detail

TXDocument

public TXDocument()
Constructor. Adds the xml namespace to this document.
Method Detail

clone

public java.lang.Object clone()
Clone this Document Node and its children using the appropriate factories.

This method is defined by Child.

Returns:
Cloned Document Node and all children.
Overrides:
clone in class Child
See Also:
Child.clone()

cloneNode

public org.w3c.dom.Node cloneNode(boolean deep)
Overrides:
cloneNode in class Child

equals

public boolean equals(org.w3c.dom.Node arg,
                      boolean deep)
Overrides:
equals in class Child

getNodeType

public short getNodeType()
Returns that this object is a Document Node.

This method is defined by DOM.

Returns:
Document Node indicator.

getNodeName

public java.lang.String getNodeName()

getDocumentElement

public org.w3c.dom.Element getDocumentElement()
Returns this Document's root Element.
Specified by:
getDocumentElement in interface org.w3c.dom.Document
Returns:
Document root Element, or null if no root Element.
See Also:
getRootName()

getRootName

public java.lang.String getRootName()
Returns the name of this Document's root Element (not DTD).
Returns:
Name of Document root Element, or null if no root element.
See Also:
getDocumentElement()

getElementsByTagName

public org.w3c.dom.NodeList getElementsByTagName(java.lang.String qName)
Returns a NodeList of matches through all child Element Nodes. Searching is done recursively, not just for immediate Child Nodes. The returned NodeList is not "live". The specified qualified name refers to the Element tag name (see Namespace for details).

This method is defined by DOM.

Specified by:
getElementsByTagName in interface org.w3c.dom.Document
Parameters:
qName - Qualified name to match against in all subordinate Elements.
Returns:
A NodeList of matched Element Nodes (TXElement). If no matches, an empty NodeList is returned.
See Also:
TXElement.getElementsByTagName(java.lang.String), Namespace

getDoctype

public org.w3c.dom.DocumentType getDoctype()
Returns this Document's Type Definition (DTD) as a Node.
Specified by:
getDoctype in interface org.w3c.dom.Document
Returns:
Document Type Definition (DTD), or null if no type.
See Also:
getDTD()

getDTD

public DTD getDTD()
Returns this Document's Type Definition (DTD) as a DTD.
Returns:
Document Type Definition (DTD), or null if no type.
See Also:
getDoctype(), isCheckValidity()

isCheckValidity

public boolean isCheckValidity()
Returns whether validity constraints are checked in this doument. In other words, return whether this document has a Document Type Definition (DTD) and the DTD has one or more element declarations (<!ELEMENT ...>).

This flag doesn't affect all validity constraints in XML 1.0. it affects only validity constraints about content model matching of elements and attribute types.

Returns:
=true if validity costraints are checked in this document; otherwise =false.

resetCheckValidity

protected void resetCheckValidity()
Reconfigure checkValidity flag.

getStandalone

public java.lang.String getStandalone()
Returns if this Document is standalone. A document that contains a standalone value of yes indicates that there are no markup declarations external to the document entity either in the DTD external subset, or in an external parameter entity referenced from the internal subset. The value no indicates that there are or may be such external markup declarations.
Returns:
=yes if standalone; =no if not standalone; =null if not known.
See Also:
setStandalone(java.lang.String), isStandalone()

isStandalone

public boolean isStandalone()
Returns if this Document is standalone. A document that contains a standalone value of true indicates that there are no markup declarations external to the document entity either in the DTD external subset, or in an external parameter entity referenced from the internal subset. The value false indicates that there are or may be such external markup declarations.
Returns:
=true if standalone; otherwise, =false.
See Also:
getStandalone(), setStandalone(java.lang.String)

setStandalone

public void setStandalone(java.lang.String standalone)
Sets if this Document is standalone. A document that contains a standalone value of yes indicates that there are no markup declarations external to the document entity either in the DTD external subset, or in an external parameter entity referenced from the internal subset. The value no indicates that there are or may be such external markup declarations.
Returns:
=yes if standalone; =no if not standalone; =null if not known.
See Also:
isStandalone(), getStandalone()

getVersion

public java.lang.String getVersion()
Returns the XML version of this Document from the XML prolog declaration (e.g. <?xml ...>).
Returns:
XML version of this Document (e.g. "1.0"), or null if version not specified.
See Also:
setVersion(java.lang.String)

setVersion

public void setVersion(java.lang.String xmlVersion)
Sets the XML version of this Document from the XML prolog declaration (e.g. <?xml ...>).
Parameters:
xmlVersion - XML version of this Document (e.g. "1.0").
See Also:
getVersion()

getEncoding

public java.lang.String getEncoding()
Returns the value of the XML encoding parameter from the XML prolog declaration (e.g. <?xml encoding="...">).
Returns:
Value of the XML encoding parameter, or null if encoding not specified.
See Also:
setEncoding(java.lang.String)

setEncoding

public void setEncoding(java.lang.String xmlEncoding)
Sets the value of the XML encoding parameter from the XML prolog declaration (e.g. <?xml encoding="...">).

The supported XML encodings are the intersection of XML-supported code sets and those supported in JDK 1.1:

Parameters:
xmlEncoding - Value of the XML encoding parameter.
See Also:
MIME2Java.convert(java.lang.String), getEncoding(), DTD.setEncoding(java.lang.String)

setProcessNamespace

public void setProcessNamespace(boolean isProcessNamespace)
Sets whether namespaces are considered in some operations to nodes created by this document. This flag is automatically set when Parser#setProcessNamespace(true) is called and this document is created by the parser.
See Also:
Parser.setProcessNamespace(boolean)

isProcessNamespace

public boolean isProcessNamespace()
Returns whether namespaces are considered.

realInsert

protected void realInsert(org.w3c.dom.Node child,
                          int index)
                   throws LibraryException
Insert a Child Node into the specified position. Special consideration is given to DTDs, the root document Element, and namspace PI children.
Parameters:
child - The Node being inserted.
index - 0-based index into the list of children.
Throws:
LibraryException - Thrown if the document's root element is set twice.
Overrides:
realInsert in class Parent

replaceChild

public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node oldChild)
                              throws org.w3c.dom.DOMException
Replaces the Child Node oldChild with newChild in this Node's list of children, and return the oldChild Node. If oldChild was not already a Child of this Node, a DOMException is thrown.

A DTD can't be replaced by this method.

This method is defined by DOM.

Parameters:
newChild - The Child Node to replace with.
oldChild - The Child Node being replaced.
Returns:
The Child Node being replaced.
Throws:
org.w3c.dom.DOMException - Thrown if oldChild is not a Child of this object.
Overrides:
replaceChild in class Parent
See Also:
removeChild(org.w3c.dom.Node)

removeChild

public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
                             throws org.w3c.dom.DOMException
Removes the Child Node indicated by oldChild from this Nodes list of children, and returns it. If oldChild was not a Child of this Node, a DOMException is thrown.

This method is defined by DOM.

Parameters:
oldChild - The Child Node being removed.
Returns:
The Child Node being removed.
Throws:
org.w3c.dom.DOMException - Thrown if oldChild is not a Child of this object.
Overrides:
removeChild in class Parent
See Also:
replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)

printWithFormat

public void printWithFormat(java.io.Writer pw)
                     throws java.io.IOException,
                            LibraryException
Format and print this Node and any children in XML format using the default character encoding.
Parameters:
pw - The character output stream to use.
Throws:
java.io.IOException - Thrown if a Node can not be visitted because of an invalid pw.
LibraryException - Thrown if the document object hierarchy is in an unknown state.
See Also:
Child.print(java.io.Writer, java.lang.String)

printWithFormat

public void printWithFormat(java.io.Writer pw,
                            java.lang.String encoding)
                     throws java.io.IOException,
                            LibraryException
Format and print this Node and any children in XML format using the specified character encoding.
Parameters:
pw - The character output stream to use.
encoding - Java character encoding in use by pw.
Throws:
java.io.IOException - Thrown if a Node can not be visitted because of an invalid pw.
LibraryException - Thrown if the document object hierarchy is in an unknown state.
See Also:
Child.print(java.io.Writer, java.lang.String)

printWithFormat

public void printWithFormat(java.io.Writer pw,
                            java.lang.String encoding,
                            int indent)
                     throws java.io.IOException,
                            LibraryException
Format and print this Node and any children in XML format, using the specified character encoding, and indented by indent spaces.
Parameters:
pw - The character output stream to use.
encoding - Java character encoding in use by pw.
indent - Number of spaces to indent at each nesting level.
Throws:
java.io.IOException - Thrown if a Node can not be visitted because of an invalid pw.
LibraryException - Thrown if the document object hierarchy is in an unknown state.
See Also:
Child.print(java.io.Writer, java.lang.String)

setPrintInternalDTD

public void setPrintInternalDTD(boolean printInternalDTD)
Sets whether the internal DTD is printed by the print() methods.
Parameters:
printInternalDTD - =true to print the internal DTD; =false to not print.

getText

public java.lang.String getText()
Return all text associated with this Node and its children without considering entities.

This method is defined by Child.

Returns:
Text associated with all children, or "" if no children.
Overrides:
getText in class Parent
See Also:
Child.toXMLString(java.io.Writer, java.lang.String)

getImplementation

public org.w3c.dom.DOMImplementation getImplementation()
Return an instance of DOMImplementation handling this document.

This method is defined by DOM.

Specified by:
getImplementation in interface org.w3c.dom.Document

acceptPre

public void acceptPre(Visitor visitor)
               throws java.lang.Exception
Implements the accept operation of the visitor design pattern when the start of a TXDocument Node is recognized when traversing the document object tree.
Parameters:
visitor - The implemention of the Visitor operation (toXMLString, digest, ...)
Throws:
java.lang.Exception - Thrown if this Node can not be visitted, or traversal modification is requested.
See Also:
Visitor, TreeTraversal, NonRecursivePreorderTreeTraversal, TreeTraversalException

acceptPost

public void acceptPost(Visitor visitor)
                throws java.lang.Exception
Implements the accept operation of the visitor design pattern when the end of a TXDocument Node is recognized when traversing the document object tree.
Parameters:
visitor - The implemention of the Visitor operation (toXMLString, digest, ...)
Throws:
java.lang.Exception - Thrown if this Node can not be visitted, or traversal modification is requested.
See Also:
Visitor, TreeTraversal, NonRecursivePreorderTreeTraversal, TreeTraversalException

getOwnerDocument

public org.w3c.dom.Document getOwnerDocument()
Returns null.

This method is defined by DOM.

Returns:
Always return null
Overrides:
getOwnerDocument in class Child

getFactory

public TXDocument getFactory()
Overrides:
getFactory in class Child

getInstance

public static TXDocument getInstance()
Returns the current TXDocument instance; if an instance does not currently exist, it will be created.
Returns:
The current default factory instance.

createElement

public org.w3c.dom.Element createElement(java.lang.String name)
                                  throws org.w3c.dom.DOMException
Create and initialize a TXElement instance using the supplied parameters.

This method is defined by DOM.

Specified by:
createElement in interface org.w3c.dom.Document
Parameters:
name - This Element's tag name (qualified name).
Returns:
Newly created TXElement.
Throws:
org.w3c.dom.DOMException - INVALID_NAME_ERR: name is invalid.

createAttribute

public org.w3c.dom.Attr createAttribute(java.lang.String name)
                                 throws org.w3c.dom.DOMException
Create and return a new Attr.

This method is defined by DOM.

Specified by:
createAttribute in interface org.w3c.dom.Document
Parameters:
name - The name of this attribute.
Returns:
New TXAttribute.
Throws:
org.w3c.dom.DOMException - INVALID_NAME_ERR: name is invalid.

createTextNode

public org.w3c.dom.Text createTextNode(java.lang.String data)
Create and initialize a TXText instance using the supplied parameters.

This method is defined by DOM.

Specified by:
createTextNode in interface org.w3c.dom.Document
Parameters:
data - The actual content of the Text Node.
Returns:
Newly created TXText.

createTextNode

public TXText createTextNode(java.lang.String data,
                             boolean isIgnorableWhitespace)
Create and initialize a TXText instance using the supplied parameters.
Parameters:
data - The actual content of the Text Node.
isIgnorableWhitespace - =true space is to be preserved; =false space is to be ignored.
Returns:
Newly created TXText.
See Also:
TXText.setIsIgnorableWhitespace(boolean)

createTextNode

public TXText createTextNode(char[] charArray,
                             int offset,
                             int length,
                             boolean isIgnorableWhitespace)
Create and initialize a TXText instance using the supplied parameters.
Parameters:
charArray - Existing character array to use as actual content of the Text Node.
offset - Offset into charArray.
length - Number of charArray characters to use.
isIgnorableWhitespace - =true space is to be preserved; =false space is to be ignored.
Returns:
Newly created TXText.
See Also:
TXText.setIsIgnorableWhitespace(boolean)

createCDATASection

public org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
                                            throws org.w3c.dom.DOMException
Create and initialize a TXCDATASection instance using the supplied parameters.

This method is defined by DOM.

Specified by:
createCDATASection in interface org.w3c.dom.Document
Parameters:
data - The actual content of the CDATASection Node.
Returns:
Newly created TXCDATASection.
Throws:
org.w3c.dom.DOMException - Never thrown.

createComment

public org.w3c.dom.Comment createComment(java.lang.String data)
Create and initialize a TXComment instance using the supplied parameters.

This method is defined by DOM.

Specified by:
createComment in interface org.w3c.dom.Document
Parameters:
data - The actual content of the Comment Node.
Returns:
Newly created TXComment.

createProcessingInstruction

public org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String name,
                                                                     java.lang.String data)
                                                              throws org.w3c.dom.DOMException
Create and initialize a TXPI instance using the supplied parameters.

This method is defined by DOM.

Specified by:
createProcessingInstruction in interface org.w3c.dom.Document
Parameters:
name - The first token following the markup.
data - From the character immediately after name to the character immediately preceding the ?>.
Returns:
Newly created TXPI.
Throws:
org.w3c.dom.DOMException - INVALID_NAME_ERR: name is invalid.

createStylesheetPI

public StylesheetPI createStylesheetPI(java.lang.String name,
                                       java.lang.String data,
                                       java.lang.String type,
                                       java.lang.String hrefURI,
                                       java.lang.String title)
Create and initialize a StylesheetPI instance using the supplied parameters.
Parameters:
name - The first token following the markup (e.g. "xml:stylesheet").
data - From the character immediately after name to the character immediately preceding the ?>.
type - The value of the type= attribute.
hrefURI - The value of the href= attribute.
title - The value of the title= attribute, or null.
Returns:
Newly created StylesheetPI.

createDTD

public DTD createDTD()
Create and initialize a DTD instance.
Returns:
Newly created DTD.

createDTD

public DTD createDTD(java.lang.String name,
                     ExternalID externalID)
Create and initialize a DTD instance using the supplied parameters.
Parameters:
name - The name of this DTD. This value is also known as the DOCTYPE and the root Element Name.
externalID - The external ID associated with this DTD.
Returns:
Newly created DTD.
See Also:
ExternalID

createElementDecl

public ElementDecl createElementDecl(java.lang.String name,
                                     ContentModel contentModel)
Create and initialize a ElementDecl instance using the supplied parameters.
Parameters:
name - This element definition's name.
contentModel - The content model to associate with this element definition, or null if the content model is to be set later.
Returns:
Newly created ElementDecl.

createContentModel

public ContentModel createContentModel(int type)
Create and initialize a ContentModel instance using the supplied parameters. This factory is for content models NOT of type MODEL_GROUP.
Parameters:
type - The type for this content model. Must be one of org.w3c.dom.ElementDefinition#ContentType. Note that the XML4J parser will never set #PCDATA as the content type; MODEL_GROUP will be set instead.
Returns:
Newly created ContentModel.

createContentModel

public ContentModel createContentModel(CMNode modelGroupNode)
Create and initialize a ContentModel instance using the supplied parameters. This factory is for content models of type MODEL_GROUP.
Parameters:
modelGroupNode - The content model associated with the model group.
Returns:
Newly created ContentModel.

createAttlist

public Attlist createAttlist(java.lang.String name)
Create and initialize a Attlist instance using the supplied parameters.
Parameters:
name - This attribute list's name; this value is also known as the Element type.
Returns:
Newly created Attlist.

createAttDef

public AttDef createAttDef(java.lang.String name)
Create and initialize a AttDef instance using the supplied parameters.
Parameters:
name - Name of this attribute as defined by the DTD.
Returns:
Newly created AttDef.

createEntityDecl

public EntityDecl createEntityDecl(java.lang.String name,
                                   java.lang.String value,
                                   boolean isParameter)
Create and initialize a EntityDecl instance using the supplied parameters. This factory is for internal entities.
Parameters:
name - Name of this entity.
value - The XML-encoded value that was directly assigned to the EntityDecl.
isParameter - =true if a parameter entity; otherwise =false.
Returns:
Newly created EntityDecl.

createEntityDecl

public EntityDecl createEntityDecl(java.lang.String name,
                                   ExternalID externalID,
                                   boolean isParameter,
                                   java.lang.String ndata)
Create and initialize a EntityDecl instance using the supplied parameters. Constructor for external entities.
Parameters:
name - Name of the entity.
externalID - The reference(s) to the external entity to retrieve.
isParameter - =true if a parameter entity; otherwise =false.
ndata - The notation associated with the binary entity, or null if the Entity is a text entity.
Returns:
Newly created EntityDecl.
See Also:
ExternalID

createNotation

public TXNotation createNotation(java.lang.String name,
                                 ExternalID externalID)
Create and initialize a TXNotation instance using the supplied parameters.
Parameters:
name - The name of the Notation.
externalID - The public or system identifier which defines the DTD's notation.
Returns:
Newly created TXNotation.

createEntityReference

public org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
                                                  throws org.w3c.dom.DOMException
Create and initialize a EntityReference instance using the supplied parameters.
Specified by:
createEntityReference in interface org.w3c.dom.Document
Parameters:
name - This reference's name. This is also the name of the entity being referred to by the general entity reference.
Returns:
Newly created EntityReference.

createDocumentFragment

public org.w3c.dom.DocumentFragment createDocumentFragment()

This method is defined by DOM.

Specified by:
createDocumentFragment in interface org.w3c.dom.Document

createEntity

public org.w3c.dom.Entity createEntity()

This method is defined by DOM. NOT IMPLEMENTED.

Returns:
Always return null.

createMessageDigest

public java.security.MessageDigest createMessageDigest()
                                                throws java.security.NoSuchAlgorithmException
Returns a newly created MessageDigest instance if none currently exists, or resets the existing digest. The digest will be created based on the existing digest algorithm (see setDigestAlgorithm).
Returns:
Newly created or reset digest.
Throws:
java.security.NoSuchAlgorithmException - Thrown if unable to create a new message digest based on the default digest algorithm.
See Also:
setDigestAlgorithm(java.lang.String)

setDigestAlgorithm

public void setDigestAlgorithm(java.lang.String defDigestAlgorithm)
Sets the default message digest algorithm for use by createMessageDigest().

By default, the message digest algorithm is MD5.

Parameters:
defDigestAlgorithm - Refer to java.security.MessageDigest for acceptable values.
See Also:
createMessageDigest()

checkChildType

protected void checkChildType(org.w3c.dom.Node child)
                       throws org.w3c.dom.DOMException
Check whether child is allowed to be insered in this node or not. When not allowed, a DOMException with HIERARCHY_REQUEST_ERR is thrown.
Overrides:
checkChildType in class Parent

isCheckOwnerDocument

public boolean isCheckOwnerDocument()
Returns a flag whether new child was created from another document. Default is false.

setCheckOwnerDocument

public void setCheckOwnerDocument(boolean doCheck)
Sets a flag whether new child was created from another document. Default is false.

isCheckNodeLoop

public boolean isCheckNodeLoop()
Returns a flag whether new child is an ancestor of a parent. Default is true.

setCheckNodeLoop

public void setCheckNodeLoop(boolean doCheck)
Sets a flag whether new child is an ancestor of a parent. Default is true.

isAddFixedAttributes

public boolean isAddFixedAttributes()
Returns a flag whether #FIXED attributes are automatically added. Default is true.
See Also:
Parser, Element.removeAttribute(java.lang.String), Element.removeAttributeNode(org.w3c.dom.Attr), TXElement.removeAttribute(java.lang.String), TXElement.removeAttributeNode(org.w3c.dom.Attr), TXElement.resetDefaultAttribute(java.lang.String)

setAddFixedAttributes

public void setAddFixedAttributes(boolean addFixedAttributes)
Sets a flag whether #FIXED attributes are automatically added. Default is true. To stop Parser adding #FIXED attributes, You must call this method before Parser#readStream().
   TXDocument doc = new TXDocument();
   doc.setAddFixedAttributes(false);
   parser.setElementFactory(doc);
   parser.readStream(....);  // This method returns doc.
 
See Also:
Parser, Element.removeAttribute(java.lang.String), Element.removeAttributeNode(org.w3c.dom.Attr), TXElement.removeAttribute(java.lang.String), TXElement.removeAttributeNode(org.w3c.dom.Attr), TXElement.resetDefaultAttribute(java.lang.String)

XML for Java Compatibility API 2.0.6