XML for Java Compatibility API 2.0.6

com.ibm.xml.parser
Class DTD

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

public class DTD
extends Parent
implements org.w3c.dom.DocumentType

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

The DTD defines the document class (type) and indicates where to find its syntactic grammar definition.

The external DTD subset is outside the XML document. Typically, it is a standardized document. The internal DTD subset forms part of the XML document itself. The internal DTD subset often contains entity declarations that are used throughout the XML document as well as other document-specific declarations.

When an XML document has both internal and external DTD subsets, the internal subset definitions are processed first, and take precedence over external subset definitions.

The following examples illustrate an external DTD reference, an internal DTD subset, and an external DTD reference combined with an internal DTD subset:


 <!DOCTYPE PGML SYSTEM "http://www.ibm.com/pgml.xml">

 <!DOCTYPE PGML [ internal DTD subset ]>

 <!DOCTYPE PGML SYSTEM "http://www.ibm.com/pgml.xml" [ internal DTD subset ]>
 

Version:
Revision: 62 1.8 src/com/ibm/xml/parser/DTD.java, parser, xml4j2, xml4j2_0_6
See Also:
DocumentType, Parent, Child, ExternalID, Serialized Form

Field Summary
static java.lang.String CM_EOC
          A constant symbol for use by getInsertableElements() and getAppendableElements() methods.
static java.lang.String CM_ERROR
          A constant symbol for use by getInsertableElements() and getAppendableElements() methods.
static java.lang.String CM_PCDATA
          A constant symbol for use by getInsertableElements() and getAppendableElements() methods.
 
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
DTD()
          Constructor.
DTD(java.lang.String name, ExternalID externalID)
          Constructor.
 
Method Summary
 void acceptPost(Visitor visitor)
          Implements the accept operation of the visitor design pattern when the end of a DTD 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 DTD 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.
 boolean checkContent(TXElement element)
          Returns whether the specified element is declared in this DTD's internal and external subsets, AND whether it currently adheres to its defined content model (see ElementDecl for details).
 org.w3c.dom.Element checkID(java.lang.String id)
          Returns the Element associated with the specified id in the XML document.
 java.lang.Object clone()
          Clone this DTD Node and its children using the appropriate factories.
 org.w3c.dom.Node cloneNode(boolean deep)
           
 boolean equals(org.w3c.dom.Node arg, boolean deep)
           
 java.util.Enumeration externalElements()
          Returns an Enumeration instance of all external subset children of this DTD.
 java.util.Hashtable getAppendableElements(org.w3c.dom.Element element, java.util.Hashtable hashtable)
          Returns a hash table which defines what kind of Element you can append onto specified element according to the document grammar specified by this DTD's internal and external subset.
 AttDef getAttributeDeclaration(java.lang.String elementName, java.lang.String attributeName)
          Return an AttDef instance that matches the specified elementName and attributeName in this DTD's internal and external subsets.
 java.util.Enumeration getAttributeDeclarations(java.lang.String elementName)
          Return an Enumeration instance of all attribute list declarations for the the specified elementName in this DTD's internal and external subsets.
 ContentModel getContentModel(java.lang.String elementName)
          Returns the ContentModel for the specified elementName in this DTD's internal and external subset (see ElementDecl for details).
 int getContentType(java.lang.String elementName)
          Returns the content model type for the specified elementName in this DTD's internal and external subset (see ElementDecl for details).
 ElementDecl getElementDeclaration(java.lang.String elementName)
          Return an ElementDecl instance that matches the specified elementName in this DTD's internal and external subsets.
 java.util.Enumeration getElementDeclarations()
          Return an Enumeration instance of all element declarations in this DTD's internal and external subsets.
 org.w3c.dom.NamedNodeMap getEntities()
          This method is defined by DOM.
 EntityDecl getEntityDecl(java.lang.String name, boolean isParameter)
          Returns an EntityDecl in this DTD's internal and external subsets that matches the specified name and is of the specified isParameter type.
 java.util.Enumeration getEntityEnumeration()
          Returns an Enumeration of all entities defined in this DTD's internal and external subsets except paramete entities.
 ExternalID getExternalID()
          Returns the external ID associated with this DTD.
 int getExternalSize()
          Return a number of Nodes in an external subset.
 java.util.Hashtable getInsertableElements(org.w3c.dom.Element element, int index, java.util.Hashtable hashtable)
          Returns a hash table which defines what kind of Element you can insert into the specified index of element according to the document grammar specified by this DTD's internal and external subset.
 java.util.Hashtable getInsertableElementsForValidContent(org.w3c.dom.Element element, int index, java.util.Hashtable hashtable)
          Returns a hash table which defines what kind of Element you can insert into the specified index of element according to the document grammar specified by this DTD's internal and external subset.
 int getInternalSize()
          Return a number of Nodes in an internal subset.
 java.lang.String getName()
          Returns this DTD's name.
 java.lang.String getNodeName()
          This method is defined by DOM.
 short getNodeType()
          Returns that this object is a DTD Node.
 org.w3c.dom.Notation getNotation(java.lang.String notationName)
          Return an Notation instance that matches the specified notationName in this DTD's internal and external subsets.
 java.util.Enumeration getNotationEnumeration()
          Return an Enumeration instance of all notation declarations (TXNotation) in this DTD's internal and external subsets.
 org.w3c.dom.NamedNodeMap getNotations()
          Returns the NamedNodeMap which has the set of notations that were defined within this DTD's external and internal subset.
 java.util.Enumeration getParameterEntityEnumeration()
          Returns an Enumeration of all parameter entities defined in this DTD's internal and external subsets.
 java.util.Enumeration IDs()
          Returns an Enumeration of all Element IDs currently registered in the XML document.
 java.util.Enumeration internalElements()
          Returns an Enumeration instance of all internal subset children of this DTD.
 boolean isAttributeDeclared(java.lang.String elementName, java.lang.String attributeName)
          Return whether an attribute definition exists that matches the specified elementName and attributeName in this DTD's internal and external subsets.
 boolean isElementDeclared(java.lang.String elementName)
          Return whether an element definition exists that matches the specified elementName in this DTD's internal and external subsets.
 boolean isParsingExternal()
          Returns whether the internal of external DTD subset is currently being parsed.
 boolean isPrintInternalDTD()
          Returns whether the print() method prints internal subse.
 java.util.Vector makeContentElementList(java.lang.String elementDeclName)
          Returns a Vector of the children of the specified elementDeclName as defined by this DTD's internal and external subset.
 java.util.Hashtable prepareTable(java.lang.String elementName)
          Prepare a hash table for use by the getInsertableElements() and getAppendableElements() methods.
 void printExternal(java.io.Writer pw, java.lang.String encoding)
          Print this DTD's external subset in XML format using the specified character encoding.
protected  void realInsert(org.w3c.dom.Node newChild, int index)
          Insert a Child Node into the specified position in this Node's list of children.
 boolean registID(org.w3c.dom.Element element, java.lang.String id)
          Register the identifier attribute associated with the specified element in the XML document.
 void setEncoding(java.lang.String xmlEncoding)
          Sets the value of the XML encoding parameter from the XML prolog declaration (e.g.
 void setEntityPool(EntityPool ent)
          Called by Parser.
 void setExternalID(ExternalID externalID)
          Sets the external ID associated with this DTD.
 void setName(java.lang.String name)
          Sets this DTD's name.
 void setParsingExternal(boolean flag)
          Sets the flag which indicates if the internal of external DTD subset is currently being parsed.
 void setPrintInternalDTD(boolean flag)
          Sets the flag which indicates if the print() method prints the internal subset.
 boolean unregistID(java.lang.String id)
          Unregister the identifier attribute associated with the specified element in the XML document.
 
Methods inherited from class com.ibm.xml.parser.Parent
addElement, appendChild, elements, expandEntityReferences, getChildNodes, getChildrenArray, getFirstChild, getFirstWithoutReference, getLastChild, getLastWithoutReference, getText, hasChildNodes, insert, insertAfter, insertBefore, insertFirst, insertLast, processAfterRemove, removeChild, replaceChild
 
Methods inherited from class com.ibm.xml.parser.Child
clearDigest, getAttributes, getDigest, getFactory, getNextSibling, getNextWithoutReference, getNodeValue, getOwnerDocument, 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

CM_EOC

public static final java.lang.String CM_EOC
A constant symbol for use by getInsertableElements() and getAppendableElements() methods.

CM_ERROR

public static final java.lang.String CM_ERROR
A constant symbol for use by getInsertableElements() and getAppendableElements() methods.

CM_PCDATA

public static final java.lang.String CM_PCDATA
A constant symbol for use by getInsertableElements() and getAppendableElements() methods.
Constructor Detail

DTD

public DTD()
Constructor.

DTD

public DTD(java.lang.String name,
           ExternalID externalID)
Constructor.
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.
See Also:
getName(), setName(java.lang.String), ExternalID
Method Detail

clone

public java.lang.Object clone()
Clone this DTD Node and its children using the appropriate factories. Note: checkID() isn't working in the clone.

This method is defined by Child.

Returns:
Cloned DTD Node.
Overrides:
clone in class Child
See Also:
Child.clone(), checkID(java.lang.String)

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 DTD Node.

This method is defined by DOM.

Returns:
DTD Node indicator.

getNodeName

public java.lang.String getNodeName()

This method is defined by DOM.


getName

public java.lang.String getName()
Returns this DTD's name. This value is also known as the DOCTYPE and the root Element Name.

This method is defined by DOM.

Specified by:
getName in interface org.w3c.dom.DocumentType
Returns:
This DTD's name, or null if no name.

setName

public void setName(java.lang.String name)
Sets this DTD's name. This value is also known as the DOCTYPE and the root Element Name.
Parameters:
name - This DTD's name.
See Also:
getName()

realInsert

protected void realInsert(org.w3c.dom.Node newChild,
                          int index)
                   throws org.w3c.dom.DOMException
Insert a Child Node into the specified position in this Node's list of children. The newChild is added to the internal or external DTD subset depending on the value of parsingExternal.
Parameters:
newChild - The Node being inserted.
index - 0-based index into the list of children.
Throws:
org.w3c.dom.DOMException - Thrown if index is not valid.
Overrides:
realInsert in class Parent
See Also:
setParsingExternal(boolean), isParsingExternal(), Parent.insert(org.w3c.dom.Node, int)

setParsingExternal

public void setParsingExternal(boolean flag)
Sets the flag which indicates if the internal of external DTD subset is currently being parsed.
Parameters:
flag - =true if parsing the external DTD subset; =false if parsing in the internal DTD subset.
See Also:
isParsingExternal(), Parent.addElement(com.ibm.xml.parser.Child)

isParsingExternal

public boolean isParsingExternal()
Returns whether the internal of external DTD subset is currently being parsed.
Returns:
=true if parsing the external DTD subset; =false if parsing in the internal DTD subset.
See Also:
setParsingExternal(boolean), Parent.addElement(com.ibm.xml.parser.Child)

internalElements

public java.util.Enumeration internalElements()
Returns an Enumeration instance of all internal subset children of this DTD.
Returns:
An enumeration of all internal subset children of this DTD.
See Also:
Parent.getChildNodes(), Parent.elements(), Parent.addElement(com.ibm.xml.parser.Child), externalElements()

externalElements

public java.util.Enumeration externalElements()
Returns an Enumeration instance of all external subset children of this DTD.
Returns:
An enumeration of all external subset children of this DTD.
See Also:
Parent.addElement(com.ibm.xml.parser.Child), internalElements()

getExternalID

public ExternalID getExternalID()
Returns the external ID associated with this DTD. An external ID contains system, and optionally, public identifiers.
Returns:
The external ID associated with this DTD, or null if no external DTD reference.
See Also:
setExternalID(com.ibm.xml.parser.ExternalID), ExternalID

setExternalID

public void setExternalID(ExternalID externalID)
Sets the external ID associated with this DTD. An external ID contains system, and optionally, public identifiers.
Parameters:
externalID - The external ID associated with this DTD.
See Also:
getExternalID(), ExternalID

getAttributeDeclarations

public java.util.Enumeration getAttributeDeclarations(java.lang.String elementName)
Return an Enumeration instance of all attribute list declarations for the the specified elementName in this DTD's internal and external subsets.
Parameters:
elementName - The Element name to match in the internal and external DTD subsets.
Returns:
An enumeration of all attribute list declarations.
See Also:
Parent.addElement(com.ibm.xml.parser.Child), getAttributeDeclaration(java.lang.String, java.lang.String), isAttributeDeclared(java.lang.String, java.lang.String)

getAttributeDeclaration

public AttDef getAttributeDeclaration(java.lang.String elementName,
                                      java.lang.String attributeName)
Return an AttDef instance that matches the specified elementName and attributeName in this DTD's internal and external subsets.
Parameters:
elementName - The Element name to match in the internal and external DTD subsets.
attributeName - The Attribute name to match in elementName.
Returns:
The matching attribute definition, or null if no match.
See Also:
Parent.addElement(com.ibm.xml.parser.Child), getAttributeDeclarations(java.lang.String), isAttributeDeclared(java.lang.String, java.lang.String)

isAttributeDeclared

public boolean isAttributeDeclared(java.lang.String elementName,
                                   java.lang.String attributeName)
Return whether an attribute definition exists that matches the specified elementName and attributeName in this DTD's internal and external subsets.
Parameters:
elementName - The Element name to match in the internal and external DTD subsets.
attributeName - The Attribute name to match in elementName.
Returns:
=true if the attribute definition exists; otherwise, =false.
See Also:
Parent.addElement(com.ibm.xml.parser.Child), getAttributeDeclarations(java.lang.String), getAttributeDeclaration(java.lang.String, java.lang.String)

getElementDeclarations

public java.util.Enumeration getElementDeclarations()
Return an Enumeration instance of all element declarations in this DTD's internal and external subsets.
Returns:
An enumeration of all element declarations.
See Also:
Parent.addElement(com.ibm.xml.parser.Child), getElementDeclaration(java.lang.String), isElementDeclared(java.lang.String), makeContentElementList(java.lang.String)

getElementDeclaration

public ElementDecl getElementDeclaration(java.lang.String elementName)
Return an ElementDecl instance that matches the specified elementName in this DTD's internal and external subsets.
Parameters:
elementName - The Element name to match in the internal and external DTD subsets.
Returns:
The matching element definition, or null if no match.
See Also:
Parent.addElement(com.ibm.xml.parser.Child), getElementDeclarations(), isElementDeclared(java.lang.String), makeContentElementList(java.lang.String)

isElementDeclared

public boolean isElementDeclared(java.lang.String elementName)
Return whether an element definition exists that matches the specified elementName in this DTD's internal and external subsets.
Parameters:
elementName - The Element name to match in the internal and external DTD subsets.
Returns:
=true if the element definition exists; otherwise, =false.
See Also:
Parent.addElement(com.ibm.xml.parser.Child), getElementDeclarations(), getElementDeclaration(java.lang.String), makeContentElementList(java.lang.String)

makeContentElementList

public java.util.Vector makeContentElementList(java.lang.String elementDeclName)
Returns a Vector of the children of the specified elementDeclName as defined by this DTD's internal and external subset.
Parameters:
elementDeclName - The element definition name to match in the internal and external DTD subsets.
Returns:
The children of the element definition, or null if the element is not defined or the element's content model is not defined as MODEL_GROUP.
See Also:
Parent.addElement(com.ibm.xml.parser.Child), getElementDeclarations(), getElementDeclaration(java.lang.String), ElementDecl

getNotationEnumeration

public java.util.Enumeration getNotationEnumeration()
Return an Enumeration instance of all notation declarations (TXNotation) in this DTD's internal and external subsets.
Returns:
An enumeration of all notations.
See Also:
getNotation(java.lang.String)

getNotation

public org.w3c.dom.Notation getNotation(java.lang.String notationName)
Return an Notation instance that matches the specified notationName in this DTD's internal and external subsets.
Parameters:
notationName - The Notation name to match in the internal and external DTD subsets.
Returns:
The matching Notation, or null if no match.
See Also:
getNotations(), getNotationEnumeration()

getNotations

public org.w3c.dom.NamedNodeMap getNotations()
Returns the NamedNodeMap which has the set of notations that were defined within this DTD's external and internal subset.

This method is defined by DOM.

Specified by:
getNotations in interface org.w3c.dom.DocumentType
Returns:
NamedNodeMap whose children are the notations for this DTD.

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="...">). This value is used when printing the DTD external subset.

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), printExternal(java.io.Writer, java.lang.String), TXDocument.setEncoding(java.lang.String)

printExternal

public void printExternal(java.io.Writer pw,
                          java.lang.String encoding)
                   throws java.io.IOException
Print this DTD's external subset in XML format using the specified character encoding.
Parameters:
pw - The character output stream to use.
encoding - Java character encoding in use by pw.

checkContent

public boolean checkContent(TXElement element)
Returns whether the specified element is declared in this DTD's internal and external subsets, AND whether it currently adheres to its defined content model (see ElementDecl for details).
Parameters:
element - The Element to check in this DTD's internal and external subset.
Returns:
=true if element exists AND it adheres to its content model; otherwise =false.
See Also:
ElementDecl, getContentModel(java.lang.String), prepareTable(java.lang.String), getInsertableElements(org.w3c.dom.Element, int, java.util.Hashtable), getAppendableElements(org.w3c.dom.Element, java.util.Hashtable)

getContentModel

public ContentModel getContentModel(java.lang.String elementName)
Returns the ContentModel for the specified elementName in this DTD's internal and external subset (see ElementDecl for details).
Parameters:
elementName - The name of element definition to check in this DTD's internal and external subset.
Returns:
The element definition's content model, or null if the element definition does not exist.
See Also:
ElementDecl, checkContent(com.ibm.xml.parser.TXElement), getContentType(java.lang.String), prepareTable(java.lang.String), getInsertableElements(org.w3c.dom.Element, int, java.util.Hashtable), getAppendableElements(org.w3c.dom.Element, java.util.Hashtable)

getContentType

public int getContentType(java.lang.String elementName)
Returns the content model type for the specified elementName in this DTD's internal and external subset (see ElementDecl for details).
Parameters:
elementName - The name of element definition to check in this DTD's internal and external subset.
Returns:
The element definition's content model type, or -1 if the element definition does not exist. Must be one of org.w3c.dom.ElementDefinition#ContentType.
See Also:
ElementDecl, checkContent(com.ibm.xml.parser.TXElement), getContentModel(java.lang.String), prepareTable(java.lang.String), getInsertableElements(org.w3c.dom.Element, int, java.util.Hashtable), getAppendableElements(org.w3c.dom.Element, java.util.Hashtable)

prepareTable

public java.util.Hashtable prepareTable(java.lang.String elementName)
Prepare a hash table for use by the getInsertableElements() and getAppendableElements() methods. Refer to getInsertableElements for details on how this table is used.
Parameters:
elementName - The name of Element to use in building the hash table.
Returns:
The constructed hash table of acceptable Elements that may be inserted; acceptable Elements are defined by the element definition defined in this DTD's internal and external subset.
See Also:
getInsertableElements(org.w3c.dom.Element, int, java.util.Hashtable), getAppendableElements(org.w3c.dom.Element, java.util.Hashtable), InsertableElement

getInsertableElements

public java.util.Hashtable getInsertableElements(org.w3c.dom.Element element,
                                                 int index,
                                                 java.util.Hashtable hashtable)
Returns a hash table which defines what kind of Element you can insert into the specified index of element according to the document grammar specified by this DTD's internal and external subset.

Usage:

DTD dtd = ...;
Hashtable table = dtd.prepareTable(element.getName());
dtd.getInsertableElements(element, index, table);

The resulting table instance consists of Element names as keys and InsertableElement as values. The following information is available about table:

insertableElement = (InsertableElement)hashtable.get("elementName")
If insertableElement != null AND insertableElement.status == true you can insert elementName Elements under element. Note that this does not mean that element will be guaranteed to have correct contents after the insertion. Otherwise, the elementName may not be inserted.
When the element's model group is ANY AND insertableElement == null, elementName may be inserted. Otherwise, elementName may not be inserted.
insertableElement = (InsertableElement)hashtable.get(DTD.CM_PCDATA)
When insertableElement.status == true, you can insert any a TXText Node under element. Note that this does not mean that element will be guaranteed to have correct contents after the insertion. Otherwise, a TXText Node may not be inserted.
insertableElement = (InsertableElement)hashtable.get(DTD.CM_EOC)
insertableElement.status indicates whether element has correct and complete contents in the subsequence of children [0, index-1].
insertableElement = (InsertableElement)hashtable.get(DTD.CM_ERROR)
When insertableElement.status is =true, insertableElement.index is the index of the first incorrect Child Node of the specified element. Note that you might still be able to insert Elements under element even if insertableElement.status is =true.
Parameters:
element - The Element to use in building the hash table.
index - The 0-based index of element's children which are to be examined for validity in preparation for insertion.
hashtable - The hash table built by prepareTable.
Returns:
The constructed hash table, or null if unable to build the hash table with the specified elementName.
See Also:
prepareTable(java.lang.String), getAppendableElements(org.w3c.dom.Element, java.util.Hashtable), getInsertableElementsForValidContent(org.w3c.dom.Element, int, java.util.Hashtable), InsertableElement

getAppendableElements

public java.util.Hashtable getAppendableElements(org.w3c.dom.Element element,
                                                 java.util.Hashtable hashtable)
Returns a hash table which defines what kind of Element you can append onto specified element according to the document grammar specified by this DTD's internal and external subset. Refer to getInsertableElements for details on how this table is used.
Parameters:
element - The Element to use in building the hash table.
hashtable - The hash table built by prepareTable.
Returns:
The constructed hash table, or null if unable to build the hash table with the specified elementName.
See Also:
prepareTable(java.lang.String), getInsertableElements(org.w3c.dom.Element, int, java.util.Hashtable), InsertableElement

getInsertableElementsForValidContent

public java.util.Hashtable getInsertableElementsForValidContent(org.w3c.dom.Element element,
                                                                int index,
                                                                java.util.Hashtable hashtable)
Returns a hash table which defines what kind of Element you can insert into the specified index of element according to the document grammar specified by this DTD's internal and external subset.

This method can be used when element already has valid content. After insertion of returned element to element, element will have valid content.

Parameters:
element - The Element to use in building the hash table.
index - The 0-based index of element's children which are to be examined for validity in preparation for insertion.
hashtable - The hash table built by prepareTable.
Returns:
The constructed hash table, or null if unable to build the hash table with the specified elementName.
See Also:
prepareTable(java.lang.String), getInsertableElements(org.w3c.dom.Element, int, java.util.Hashtable), InsertableElement

registID

public boolean registID(org.w3c.dom.Element element,
                        java.lang.String id)
Register the identifier attribute associated with the specified element in the XML document. Registered identifiers must be unique within an XML document. An existing identifier attribute must be unregistered before it can be registered with another element.

The XML4J parser automatically invokes this method when parsing a document with DTD. After parsing, the responsibility for calling registID IDs lies with the programmer adding, deleting or modifiying elements.

Parameters:
element - Element to be registered.
id - Identifier to be registered.
Returns:
=true if successfully register; =false if id already is registered in the XML document. Then unregistID must be called before register.
See Also:
unregistID(java.lang.String), checkID(java.lang.String), IDs()

unregistID

public boolean unregistID(java.lang.String id)
Unregister the identifier attribute associated with the specified element in the XML document. Registered identifiers must be unique within an XML document. An existing identifier attribute must be unregistered before it can be registered with another element.

The responsibility for calling unregistID IDs lies with the programmer adding, deleting or modifiying elements.

Parameters:
id - Identifier to be unregistered.
Returns:
=true if successfully unregister; =false if id wasn't registered in the XML document.
See Also:
registID(org.w3c.dom.Element, java.lang.String), checkID(java.lang.String), IDs()

checkID

public org.w3c.dom.Element checkID(java.lang.String id)
Returns the Element associated with the specified id in the XML document.
Parameters:
id - Identifier to be matched.
Returns:
Matching Element, or null if id is not registered.
See Also:
registID(org.w3c.dom.Element, java.lang.String), IDs()

IDs

public java.util.Enumeration IDs()
Returns an Enumeration of all Element IDs currently registered in the XML document.
Returns:
An enumeration of String representing all currently registered Element IDs.
See Also:
checkID(java.lang.String), IDs()

getEntityEnumeration

public java.util.Enumeration getEntityEnumeration()
Returns an Enumeration of all entities defined in this DTD's internal and external subsets except paramete entities.
Returns:
An enumeration of EntityDecl representing all defined entities in this DTD's internal and external subsets.
See Also:
EntityDecl

getParameterEntityEnumeration

public java.util.Enumeration getParameterEntityEnumeration()
Returns an Enumeration of all parameter entities defined in this DTD's internal and external subsets.
Returns:
An enumeration of EntityDecl representing all defined entities in this DTD's internal and external subsets.
See Also:
EntityDecl

getEntityDecl

public EntityDecl getEntityDecl(java.lang.String name,
                                boolean isParameter)
Returns an EntityDecl in this DTD's internal and external subsets that matches the specified name and is of the specified isParameter type.
Parameters:
name - The entity name to match against in this DTD's internal and external DTD subset.
isParameter - =true if a parameter entity; otherwise =false.
Returns:
The matching EntityDecl, or null if no match.
See Also:
getEntityEnumeration()

getEntities

public org.w3c.dom.NamedNodeMap getEntities()

This method is defined by DOM.

Specified by:
getEntities in interface org.w3c.dom.DocumentType
See Also:
getEntityEnumeration()

getInternalSize

public int getInternalSize()
Return a number of Nodes in an internal subset.

getExternalSize

public int getExternalSize()
Return a number of Nodes in an external subset.

setPrintInternalDTD

public void setPrintInternalDTD(boolean flag)
Sets the flag which indicates if the print() method prints the internal subset. By default, the internal DTD subset is printed.
See Also:
isPrintInternalDTD(), Child.print(java.io.Writer, java.lang.String)

isPrintInternalDTD

public boolean isPrintInternalDTD()
Returns whether the print() method prints internal subse.
See Also:
setPrintInternalDTD(boolean), Child.print(java.io.Writer, java.lang.String)

acceptPre

public void acceptPre(Visitor visitor)
               throws java.lang.Exception
Implements the accept operation of the visitor design pattern when the start of a DTD 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 visited, 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 DTD 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 visited, or traversal modification is requested.
See Also:
Visitor, TreeTraversal, NonRecursivePreorderTreeTraversal, TreeTraversalException

setEntityPool

public void setEntityPool(EntityPool ent)
Called by Parser.

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

XML for Java Compatibility API 2.0.6