Class com.ibm.xml.parser.DTD
java.lang.Object
|
+----com.ibm.xml.parser.Child
|
+----com.ibm.xml.parser.Parent
|
+----com.ibm.xml.parser.DTD
- Subclasses:
- TreeFactory.TreeDTD
- public class DTD
- extends Parent
- implements 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: 95 1.6 src/com/ibm/xml/parser/DTD.java, xml4jsrc, xml4j-jtcsv, xml4j_1_0_4
- See Also:
- DocumentType, Parent, Child, ExternalID
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.
|
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.
|
void
|
addElement(Child newChild)
Inserts the specified newChild as the last Child in this DTD subset; the
newChild is added to the internal or external DTD subset depending on the
value of parsingExternal.
|
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).
|
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.
|
java.util.Enumeration
|
elements()
Return an Enumeration instance of all internal subset children of this DTD.
|
java.util.Enumeration
|
externalElements()
Returns an Enumeration instance of all external subset children of this DTD.
|
java.util.Hashtable
|
getAppendableElements(TXElement 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.
|
NodeIterator
|
getChildNodes()
Returns a NodeIterator of the internal DTD subset children;
this iterator is "live" (see Parent#getChildNodes for details).
|
Child[]
|
getChildrenArray()
Return an array of Child Nodes for all internal subset children of this DTD.
|
ContentModel
|
getContentModel(java.lang.String elementDeclName)
Returns the ContentModel for the specified elementDeclName
in this DTD's internal and external subset (see ElementDecl for details).
|
int
|
getContentType(java.lang.String elementDeclName)
Returns the content model type for the specified elementDeclName
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.
|
Node
|
getElementTypes()
Returns the Node whose children constitute the set of element types
that were defined within this DTD's external and internal subset.
|
java.util.Enumeration
|
getEntities()
Returns an Enumeration of all entities defined in this DTD's internal and
external subsets.
|
Entity
|
getEntity(java.lang.String name,
boolean isParameter)
Returns an Entity in this DTD's internal and external subsets that matches the
specified name and is of the specified isParameter type.
|
ExternalID
|
getExternalID()
Returns the external ID associated with this DTD.
|
int
|
getExternalSize()
Return a number of Nodes in an external subset.
|
Node
|
getExternalSubset()
Returns the Node whose children constitute this DTD's external subset.
|
Node
|
getGeneralEntities()
Returns the Node whose children constitute the set of general entities
that were defined within this DTD's external and internal subset.
|
java.util.Hashtable
|
getInsertableElements(TXElement 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(TXElement 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.
|
Node
|
getInternalSubset()
Sets the Node whose children constitute this DTD's internal subset.
|
java.lang.String
|
getName()
Returns this DTD's name.
|
int
|
getNodeType()
Returns that this object is a DTD Node.
|
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 notations in this DTD's internal and external subsets.
|
Node
|
getNotations()
Returns the Node whose children constitute the set of notations
that were defined within this DTD's external and internal subset.
|
Node
|
getParameterEntities()
Returns the Node whose children constitute the set of parameter entities
that were defined within this DTD's external and internal subset.
|
boolean
|
hasChildNodes()
Returns true if this DTD has any internal subset children, or false
if this DTD has no internal subset children at all.
|
java.util.Enumeration
|
IDs()
Returns an Enumeration of all Element IDs currently registered in the XML document.
|
void
|
insert(Child child,
int index)
Invalidate this Parent class function because DTDs have multiple Child lists.
Deprecated |
Node
|
insertBefore(Node newChild,
Node refChild)
Invalidate this Parent class function because DTDs have multiple Child lists.
Deprecated |
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.
|
boolean
|
registID(Element element,
java.lang.String id)
Register the identifier attribute associated with the specified element in the XML document.
|
Node
|
removeChild(Node oldChild)
Invalidate this Parent class function because DTDs have multiple Child lists.
Deprecated |
Node
|
replaceChild(Node oldChild,
Node newChild)
Invalidate this Parent class function because DTDs have multiple Child lists.
Deprecated |
void
|
setElementTypes(Node node)
Sets the Node whose children constitute the set of element types
that were defined within this DTD's external and internal subset.
|
void
|
setEncoding(java.lang.String xmlEncoding)
Sets the value of the XML encoding parameter from the XML prolog declaration (e.g.
|
void
|
setExternalID(ExternalID externalID)
Sets the external ID associated with this DTD.
|
void
|
setExternalSubset(Node node)
Sets the Node whose children constitute this DTD's external subset.
|
void
|
setGeneralEntities(Node arg)
Sets the Node whose children constitute the set of general entities
that were defined within this DTD's external and internal subset.
|
void
|
setInternalSubset(Node node)
Sets the Node whose children constitute this DTD's internal subset.
|
void
|
setName(java.lang.String name)
Sets this DTD's name.
|
void
|
setNotations(Node notations)
Sets the Node whose children constitute the set of notations
that were defined within this DTD's external and internal subset.
|
void
|
setParameterEntities(Node node)
Sets the Node whose children constitute the set of parameter entities
that were defined within this DTD's external and internal subset.
|
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.
|
Methods inherited from class com.ibm.xml.parser.Parent
|
addElement, elements, getChildNodes, getChildrenArray, getFirstChild, hasChildNodes, insert, insertAfter, insertBefore, insertFirst, insertLast, removeChild, replaceChild |
Methods inherited from class com.ibm.xml.parser.Child
|
clearDigest, clone, getChildNodes, getDigest, getFactory, getFirstChild, getNextSibling, getParentNode, getPreviousSibling, getText, hasChildNodes, insertBefore, makeXPointer, print, print, removeChild, replaceChild, searchAncestors, searchAncestors, setFactory, toXMLString, toXMLString |
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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.
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, ExternalID
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:
- clone, checkID(java.lang.String)
getNodeType
public int getNodeType()
- Returns that this object is a DTD Node.
This method is defined by DOM.
- Returns:
- DTD Node indicator.
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.
- Implements:
- getName in interface DocumentType
- Returns:
- This DTD's name, or null if no name.
- See Also:
- setName
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.
This method is defined by DOM.
- Implements:
- setName in interface DocumentType
- Parameters:
name
- This DTD's name.
- See Also:
- getName
getChildNodes
public NodeIterator getChildNodes()
- Returns a NodeIterator of the internal DTD subset children;
this iterator is "live" (see Parent#getChildNodes for details).
This method is defined by DOM.
- Returns:
- A NodeIterator of declarations. If there is no internal DTD subset,
an empty iterator is returned.
- Overrides:
- getChildNodes in class Parent
- See Also:
- hasChildNodes, elements, addElement, getChildrenArray, internalElements, getChildNodes
hasChildNodes
public boolean hasChildNodes()
- Returns true if this DTD has any internal subset children, or false
if this DTD has no internal subset children at all.
This method exists both for convenience as well as to allow implementations to be able
to bypass object allocation, which may be required for implementing getChildNodes().
This method is defined by DOM.
- Returns:
- True if any DTD interal subset children exist; otherwise, returns false.
- Overrides:
- hasChildNodes in class Parent
- See Also:
- getChildNodes, elements, addElement, getChildrenArray, internalElements
elements
public java.util.Enumeration elements()
- Return an Enumeration instance of all internal subset children of this DTD.
- Returns:
- An enumeration of all internal subset children of this DTD.
- Overrides:
- elements in class Parent
- See Also:
- getChildNodes, hasChildNodes, addElement, getChildrenArray, internalElements
addElement
public void addElement(Child newChild)
- Inserts the specified newChild as the last Child in this DTD subset; the
newChild is added to the internal or external DTD subset depending on the
value of parsingExternal.
- Parameters:
newChild
- The Child being inserted.
- Overrides:
- addElement in class Parent
- See Also:
- setParsingExternal, isParsingExternal, getChildNodes, hasChildNodes, elements, getChildrenArray, internalElements
getChildrenArray
public Child[] getChildrenArray()
- Return an array of Child Nodes for all internal subset children of this DTD.
- Returns:
- An array of all internal subset children of this DTD, or null if no children.
- Overrides:
- getChildrenArray in class Parent
- See Also:
- getChildNodes, hasChildNodes, elements, addElement, internalElements
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, addElement
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, addElement
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:
- getChildNodes, hasChildNodes, elements, addElement, getChildrenArray, 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:
- addElement, internalElements
insert
public void insert(Child child,
int index)
- Note: insert() is deprecated.This method will not be implemented in XML4J.
- Invalidate this
Parent
class function because DTDs have multiple Child lists.
- Overrides:
- insert in class Parent
- See Also:
- addElement
insertBefore
public Node insertBefore(Node newChild,
Node refChild)
- Note: insertBefore() is deprecated.This method will not be implemented in XML4J.
- Invalidate this
Parent
class function because DTDs have multiple Child lists.
- Returns:
- Always returns null.
- Overrides:
- insertBefore in class Parent
- See Also:
- addElement
replaceChild
public Node replaceChild(Node oldChild,
Node newChild)
- Note: replaceChild() is deprecated.This method will not be implemented in XML4J.
- Invalidate this
Parent
class function because DTDs have multiple Child lists.
- Returns:
- Always returns null.
- Overrides:
- replaceChild in class Parent
- See Also:
- addElement
removeChild
public Node removeChild(Node oldChild)
- Note: removeChild() is deprecated.This method will not be implemented in XML4J.
- Invalidate this
Parent
class function because DTDs have multiple Child lists.
- Returns:
- Always returns null.
- Overrides:
- removeChild in class Parent
- See Also:
- addElement
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, 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:
- addElement, getAttributeDeclaration, isAttributeDeclared
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:
- addElement, getAttributeDeclarations, isAttributeDeclared
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:
- addElement, getAttributeDeclarations, getAttributeDeclaration
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:
- addElement, getElementDeclaration, isElementDeclared, makeContentElementList
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:
- addElement, getElementDeclarations, isElementDeclared, makeContentElementList
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:
- addElement, getElementDeclarations, getElementDeclaration, makeContentElementList
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:
- addElement, getElementDeclarations, getElementDeclaration, ElementDecl
getNotationEnumeration
public java.util.Enumeration getNotationEnumeration()
- Return an Enumeration instance of all notations in this DTD's internal and external subsets.
- Returns:
- An enumeration of all notations.
- See Also:
- addElement, getNotation
getNotation
public 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:
- addElement, getNotationEnumeration
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:
- UTF-16
- ISO-10646-UCS-2
- ISO-10646-UCS-4
- UTF-8
- US-ASCII
- ISO-8859-1 ... ISO-8859-9
- ISO-2022-JP
- Shift_JIS
- EUC-JP
- GB2312
- Big5
- KSC5601
- ISO2022KR
- KOI8_R
- Parameters:
xmlEncoding
- Value of the XML encoding parameter.
- See Also:
- convert, printExternal, setEncoding
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, prepareTable, getInsertableElements, getAppendableElements
getContentModel
public ContentModel getContentModel(java.lang.String elementDeclName)
- Returns the ContentModel for the specified elementDeclName
in this DTD's internal and external subset (see ElementDecl for details).
- Parameters:
elementDeclName
- 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, getContentType, prepareTable, getInsertableElements, getAppendableElements
getContentType
public int getContentType(java.lang.String elementDeclName)
- Returns the content model type for the specified elementDeclName
in this DTD's internal and external subset (see ElementDecl for details).
- Parameters:
elementDeclName
- The name of element definition to check in this DTD's internal and
external subset.
- Returns:
- The element definition's content model type, or null
if the element definition does not exist.
Must be one of org.w3c.dom.ElementDefinition#ContentType.
- See Also:
- ElementDecl, checkContent, getContentModel, prepareTable, getInsertableElements, getAppendableElements
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, getAppendableElements, InsertableElement
getInsertableElements
public java.util.Hashtable getInsertableElements(TXElement 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_ERROR)
insertableElement.status
indicates whether element has
correct and complete contents in the subsequence of children [0, index-1].
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 TXElement 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, getAppendableElements, getInsertableElementsForValidContent, InsertableElement
getAppendableElements
public java.util.Hashtable getAppendableElements(TXElement 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 TXElement 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, getInsertableElements, InsertableElement
getInsertableElementsForValidContent
public java.util.Hashtable getInsertableElementsForValidContent(TXElement 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 TXElement 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, getInsertableElements, InsertableElement
registID
public boolean registID(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.
The XML4J parser automatically invokes this method when parsing a document with DTD.
- 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.
- See Also:
- checkID, IDs
checkID
public 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, 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, IDs
getEntities
public java.util.Enumeration getEntities()
- Returns an Enumeration of all entities defined in this DTD's internal and
external subsets.
- Returns:
- An enumeration of EntityValue representing all defined
entities in this DTD's internal and external subsets.
- See Also:
- getEntity, com.ibm.xml.parser.EntityValue
getEntity
public Entity getEntity(java.lang.String name,
boolean isParameter)
- Returns an Entity 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 Entity, or null if no match.
- See Also:
- getEntities
getParameterEntities
public Node getParameterEntities()
- Returns the Node whose children constitute the set of parameter entities
that were defined within this DTD's external and internal subset.
This method is defined by DOM.
This method is CURRENTLY NOT IMPLEMENTED.
- Implements:
- getParameterEntities in interface DocumentType
- Returns:
- Node whose children are the parameter entitities for this DTD, or
null if no parameter entitities are defined.
- See Also:
- setParameterEntities
setParameterEntities
public void setParameterEntities(Node node)
- Sets the Node whose children constitute the set of parameter entities
that were defined within this DTD's external and internal subset.
This method is defined by DOM.
This method is CURRENTLY NOT IMPLEMENTED.
- Implements:
- setParameterEntities in interface DocumentType
- Parameters:
node
- Node whose children are the parameter entitities for this DTD.
- See Also:
- getParameterEntities
getExternalSubset
public Node getExternalSubset()
- Returns the Node whose children constitute this DTD's external subset.
This method is defined by DOM.
This method is CURRENTLY NOT IMPLEMENTED.
- Implements:
- getExternalSubset in interface DocumentType
- Returns:
- Node whose children are this DTD's external subset, or null
if no external DTD subset exists.
- See Also:
- setExternalSubset
setExternalSubset
public void setExternalSubset(Node node)
- Sets the Node whose children constitute this DTD's external subset.
This method is defined by DOM.
This method is CURRENTLY NOT IMPLEMENTED.
- Implements:
- setExternalSubset in interface DocumentType
- Parameters:
node
- Node whose children are this DTD's external subset.
- See Also:
- getExternalSubset
getGeneralEntities
public Node getGeneralEntities()
- Returns the Node whose children constitute the set of general entities
that were defined within this DTD's external and internal subset.
This method is defined by DOM.
This method is CURRENTLY NOT IMPLEMENTED.
- Implements:
- getGeneralEntities in interface DocumentType
- Returns:
- Node whose children are the general entitities for this DTD, or
null if no general entitities are defined.
- See Also:
- setGeneralEntities
setGeneralEntities
public void setGeneralEntities(Node arg)
- Sets the Node whose children constitute the set of general entities
that were defined within this DTD's external and internal subset.
This method is defined by DOM.
This method is CURRENTLY NOT IMPLEMENTED.
- Implements:
- setGeneralEntities in interface DocumentType
- Parameters:
node
- Node whose children are the general entitities for this DTD.
- See Also:
- getGeneralEntities
getInternalSubset
public Node getInternalSubset()
- Sets the Node whose children constitute this DTD's internal subset.
This method is defined by DOM.
This method is CURRENTLY NOT IMPLEMENTED.
- Implements:
- getInternalSubset in interface DocumentType
- Returns:
- Node whose children are this DTD's internal subset, or null
if no internal DTD subset exists.
- See Also:
- setInternalSubset
setInternalSubset
public void setInternalSubset(Node node)
- Sets the Node whose children constitute this DTD's internal subset.
This method is defined by DOM.
This method is CURRENTLY NOT IMPLEMENTED.
- Implements:
- setInternalSubset in interface DocumentType
- Parameters:
node
- Node whose children are this DTD's internal subset.
- See Also:
- getInternalSubset
getNotations
public Node getNotations()
- Returns the Node whose children constitute the set of notations
that were defined within this DTD's external and internal subset.
This method is defined by DOM.
This method is CURRENTLY NOT IMPLEMENTED.
- Implements:
- getNotations in interface DocumentType
- Returns:
- Node whose children are the notations for this DTD, or
null if no notations are defined.
- See Also:
- setNotations
setNotations
public void setNotations(Node notations)
- Sets the Node whose children constitute the set of notations
that were defined within this DTD's external and internal subset.
This method is defined by DOM.
This method is CURRENTLY NOT IMPLEMENTED.
- Implements:
- setNotations in interface DocumentType
- Parameters:
node
- Node whose children are the notations for this DTD.
- See Also:
- getNotations
getElementTypes
public Node getElementTypes()
- Returns the Node whose children constitute the set of element types
that were defined within this DTD's external and internal subset.
This method is defined by DOM.
This method is CURRENTLY NOT IMPLEMENTED.
- Implements:
- getElementTypes in interface DocumentType
- Returns:
- Node whose children are the element type for this DTD, or
null if no element types are defined.
- See Also:
- setElementTypes
setElementTypes
public void setElementTypes(Node node)
- Sets the Node whose children constitute the set of element types
that were defined within this DTD's external and internal subset.
This method is defined by DOM.
This method is CURRENTLY NOT IMPLEMENTED.
- Implements:
- setElementTypes in interface DocumentType
- Parameters:
node
- Node whose children are the element type for this DTD.
- See Also:
- getElementTypes
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, print
isPrintInternalDTD
public boolean isPrintInternalDTD()
- Returns whether the
print()
method prints internal subse.
- See Also:
- setPrintInternalDTD, print
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