public class DTD extends XMLNode implements DocumentType, java.io.Externalizable
ATTRDECL, Auto_Events, capturing, DOMAttrModified, DOMCharacterDataModified, DOMNodeInserted, DOMNodeInsertedIntoDocument, DOMNodeRemoved, DOMNodeRemovedFromDocument, DOMSubtreeModified, ELEMENTDECL, KEPT_NODE, NAMESPACE_NODE, noncapturing, RANGE_DELETE_EVENT, RANGE_DELETETEXT_EVENT, RANGE_INSERT_EVENT, RANGE_INSERTTEXT_EVENT, RANGE_REPLACE_EVENT, RANGE_SETTEXT_EVENT, SCHEMA_NILLED, TRAVERSAL_DELETE_EVENT, TRAVERSAL_REPLACE_EVENT, XMLDECL_NODE
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
VAL_FALSE, VAL_INCOMPLETE, VAL_NS_WF, VAL_SCHEMA, VAL_TRUE, VAL_UNKNOWN, VAL_WF
Constructor and Description |
---|
DTD()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
XMLDocument |
convertDTD2Schema()
get XML Schema DOM tree from this DTD object
|
ElementDecl |
findElementDecl(java.lang.String name)
Finds an element declaration for the given tag name.
|
Entity |
findEntity(java.lang.String name, boolean isPE)
Finds a named entity in the DTD.
|
Notation |
findNotation(java.lang.String name)
Retrieves the named notation from the DTD.
|
NamedNodeMap |
getElementDecls()
A
NamedNodeMap containing the element declarations in the DTD. |
NamedNodeMap |
getEntities()
A
NamedNodeMap containing the general entities, both external and internal, declared in the DTD. |
java.lang.String |
getInternalSubset()
Gets the internal subset of the DTD
|
java.lang.String |
getName()
Gets the name of the DTD; i.e., the name immediately following the
DOCTYPE keyword. |
java.lang.String |
getNodeName()
Gets the name of this node, depending on its type
|
short |
getNodeType()
Gets a code representing the type of the underlying object
|
NamedNodeMap |
getNotations()
A
NamedNodeMap containing the notations declared in the DTD. |
Document |
getOwnerDocument()
Gets the
Document object associated with this node. |
java.lang.String |
getPublicId()
Gets The public identifier associated with the DTD, if specified.
|
java.lang.String |
getRootTag()
Get the root tag for the DTD
|
java.lang.String |
getSystemId()
Gets the system identifier associated with the DTD, if specified.
|
boolean |
hasChildNodes()
This is a convenience method to allow easy determination of whether a node has any children. return false always, as DTD cannot have any overrides method in XMLNode
|
Node |
insertBefore(Node newChild, Node refChild)
Inserts the node
newChild before the existing child node refChild . |
void |
printExternalDTD(java.io.OutputStream out)
Writes the contents of this document to the given output stream.
|
void |
printExternalDTD(java.io.OutputStream out, java.lang.String enc)
Writes the contents of the external DTD to the given output stream.
|
void |
printExternalDTD(java.io.PrintWriter out)
Writes the contents of this document to the given output stream.
|
void |
readExternal(java.io.ObjectInput inArg)
This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.
|
Node |
replaceChild(Node newChild, Node oldChild)
Replaces the child node
oldChild with newChild in the list of children, and returns the oldChild node. |
void |
setRootTag(java.lang.String root)
Set the root tag for the DTD
|
void |
writeExternal(java.io.ObjectOutput outArg)
This method saves the state of the object by creating a binray compressed stream with information about this object.
|
addEventListener, addText, appendChild, canAppendChild, canInsertBefore, canRemoveChild, canReplaceChild, cloneNode, dispatchEvent, equals, getAttributes, getChildNodes, getColumnNumber, getDebugMode, getDefaultValue, getEnumeratedValues, getFirstChild, getFirstChildAsOffset, getLastChild, getLineNumber, getLocalName, getNamespaceURI, getNextSibling, getNextSiblingAsOffset, getNodeValue, getNodeValueAsBinaryStream, getNodeValueAsBinaryStream, getNodeValueAsCharacterStream, getNodeValueAsCharacterStream, getParentNode, getPrefix, getPreviousSibling, getPrimitiveTypeId, getProperty, getText, getXMLError, hasAttributes, hashCode, isDocumentFlag, isNodeFlag, isSupported, nodeValidity, normalize, print, print, print, print, removeChild, removeEventListener, reportSAXEvents, resetNodeFlag, selectNodes, selectNodes, selectSingleNode, selectSingleNode, setDebugInfo, setNodeFlag, setNodeFlag, setNodeFlag, setNodeValue, setNodeValueAsBinaryStream, setNodeValueAsBinaryStream, setNodeValueAsCharacterStream, setNodeValueAsCharacterStream, setPrefix, setProperty, transformNode, valueOf, valueOf, xdbGetNodeId
getClass, notify, notifyAll, toString, wait, wait, wait
appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getParentNode, getPrefix, getPreviousSibling, hasAttributes, isSupported, normalize, removeChild, setNodeValue, setPrefix
public DTD()
public short getNodeType()
getNodeType
in interface Node
getNodeType
in class XMLNode
public java.lang.String getNodeName()
getNodeName
in interface Node
getNodeName
in class XMLNode
public java.lang.String getName()
DOCTYPE
keyword.getName
in interface DocumentType
public NamedNodeMap getEntities()
NamedNodeMap
containing the general entities, both external and internal, declared in the DTD. Duplicates are discarded. For example in:<!DOCTYPE ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar "bar"> <!ENTITY % baz "baz">]> <ex/> the interface provides access to foo
and bar
but not baz
. Every node in this map also implements the Entity
interface.entities
cannot be altered in any way.getEntities
in interface DocumentType
public NamedNodeMap getNotations()
NamedNodeMap
containing the notations declared in the DTD. Duplicates are discarded. Every node in this map also implements the Notation
interface.notations
cannot be altered in any way.getNotations
in interface DocumentType
public NamedNodeMap getElementDecls()
NamedNodeMap
containing the element declarations in the DTD. Every node in this map is an ElementDecl
object.elementdecls
cannot be altered in any way.public boolean hasChildNodes()
hasChildNodes
in interface Node
hasChildNodes
in class XMLNode
false
as DTD node can not have any children,public java.lang.String getPublicId()
null
.getPublicId
in interface DocumentType
public java.lang.String getSystemId()
null
.getSystemId
in interface DocumentType
getSystemId
in class XMLNode
public java.lang.String getInternalSubset()
getInternalSubset
in interface DocumentType
public Document getOwnerDocument()
Document
object associated with this node. This is also the Document
object used to create new nodes. When this node is a Document
this is null
.getOwnerDocument
in interface Node
getOwnerDocument
in class XMLNode
public void setRootTag(java.lang.String root)
root
- the root tagpublic java.lang.String getRootTag()
public final Entity findEntity(java.lang.String name, boolean isPE)
name
- The name of the entity.isPE
- Is this a parameter entity (as opposed to a general entity)?Entity
object; returns null if it is not found.public final ElementDecl findElementDecl(java.lang.String name)
name
- The tag name.public final Notation findNotation(java.lang.String name)
name
- The name of the notation.Notation
object; returns null if it is not found.public XMLDocument convertDTD2Schema()
public void printExternalDTD(java.io.PrintWriter out) throws java.io.IOException
out
- PrintWriter
to write tojava.io.IOException
- if an error occurspublic void printExternalDTD(java.io.OutputStream out) throws java.io.IOException
out
- OutputStream
to write tojava.io.IOException
- if an error occurspublic void printExternalDTD(java.io.OutputStream out, java.lang.String enc) throws java.io.IOException
out
- OutputStream
to write toenc
- Encoding to use for the outputjava.io.IOException
- if an invalid encoding was specified or if any other error occurspublic void writeExternal(java.io.ObjectOutput outArg) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
writeExternal
in class XMLNode
outArg
- The ObjectOutput stream used to write the serialized/ compressed stream.java.io.IOException
- is thrown when there is an exception while writing the serialized/compressed stream.public void readExternal(java.io.ObjectInput inArg) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
readExternal
in class XMLNode
inArg
- the ObjectInput stream used for reading the compressed stream.java.io.IOException
- is thrown when there is an error in reading the input stream.java.lang.ClassNotFoundException
- is thrown when the class is not found.public Node insertBefore(Node newChild, Node refChild) throws DOMException
newChild
before the existing child node refChild
. If refChild
is null
, insert newChild
at the end of the list of children.newChild
is a DocumentFragment
object, all of its children are inserted, in the same order, before refChild
. If the newChild
is already in the tree, it is first removed.insertBefore
in interface Node
insertBefore
in class XMLNode
newChild
- The node to insert.refChild
- The reference node, i.e., the node before which the new node must be inserted.DOMException
- HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild
node, or if the node to insert is one of this node's ancestors.newChild
was created from a different document than the one that created this node.refChild
is not a child of this node.public Node replaceChild(Node newChild, Node oldChild) throws DOMException
oldChild
with newChild
in the list of children, and returns the oldChild
node. If the newChild
is already in the tree, it is first removed.replaceChild
in interface Node
replaceChild
in class XMLNode
newChild
- The new node to put in the child list.oldChild
- The node being replaced in the list.DOMException
- HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild
node, or it the node to put in is one of this node's ancestors.newChild
was created from a different document than the one that created this node.oldChild
is not a child of this node.