Class DTD
public class DTD
{
// Constructors
public DTD();
// Methods
public final void addLoadedNameSpace(Name url);
public final void addNameSpace(Name as, Name href);
final public void clear();
public final Enumeration elementDeclarations();
public final ElementDecl findElementDecl(Name name);
public final Entity findEntity(Name n);
public final Name findLoadedNameSpace(Name url);
public final Name findLongNameSpace(Name as);
public final Notation findNotation(Name name);
public final Name findShortNameSpace(Name href);
final public Name getDocType();
static public boolean isReservedNameSpace(Name n);
final public void save(XMLOutputStream o) throws IOException;
}
This class contains all the Document Type Definition (DTD) information for an XML document.
public DTD();
Creates a new empty DTD.
public final void addLoadedNameSpace(Name url);
Adds a specified URL to the list of loaded namespaces.
Return Value:
No return value.
Parameter | Description |
url
| The long name for the namespace.
|
public final void addNameSpace(Name as, Name href);
Adds a name pair (long name, short name) to the name space hashtable.
Return Value:
No return value.
Parameter | Description |
as
| The long name part of the namespace.
|
href
| The short name part of the namespace.
|
final public void clear();
Resets the DTD to its initial state.
Return Value:
No return value.
public final Enumeration elementDeclarations();
Retrieves an object for enumerating the element declarations.
Return Value:
Returns an Enumeration object that returns ElementDecl objects when enumerated.
public final ElementDecl findElementDecl(Name name);
Finds an element declaration for the given tag name.
Return Value:
Returns the element declaration object.
Parameter | Description |
name
| The tag name.
|
public final Entity findEntity(Name n);
Finds a named entity in the DTD.
Return Value:
Returns the specified Entity object; returns null if it is not found.
Parameter | Description |
n
| The name of the entity.
|
public final Name findLoadedNameSpace(Name url);
Determines whether the specified URL is already a loaded namespace so that the caller can decide not to load it again.
Return Value:
Returns true if it is already loaded; otherwise, returns false.
Parameter | Description |
url
| The long name for the namespace.
|
public final Name findLongNameSpace(Name as);
Retrieves the long name of a specified namespace.
Return Value:
Returns the long name; returns null if it is not found.
Parameter | Description |
as
| The short name of the namespace.
|
public final Notation findNotation(Name name);
Retrieves the named XML notation in the DTD.
Return Value:
Returns the Notation object; returns null if it is not found.
Parameter | Description |
name
| The name of the notation.
|
public final Name findShortNameSpace(Name href);
Retrieves the short name of a specified namespace.
Return Value:
Returns the short name; returns null if it is not found.
Parameter | Description |
href
| The long name of the namespace.
|
final public Name getDocType();
Retrieves the name specified in the DOCTYPE tag.
Return Value:
Returns the name of the document type.
static public boolean isReservedNameSpace(Name n);
Determines if the given namespace is reserved.
Return Value:
Returns true if reserved; otherwise, returns false.
Parameter | Description |
n
| The namespace to verify.
|
final public void save(XMLOutputStream o) throws IOException;
Saves the DTD information to the given XML output stream.
Return Value:
No return value.
Parameter | Description |
o
| The output stream to write to.
|
Exceptions:
IOException
if there are problems writing to the output stream.