Class DTD

public class DTD
{
  // Constructors
  public DTD();

  // Methods
  public final void addLoadedNameSpace(Atom url);
  public final void addNameSpace(Atom as, Atom href);
  final public void clear();
  public final Enumeration elementDeclarations();
  public final Enumeration entityDeclarations();
  public final ElementDecl findElementDecl(Name name);
  public final Entity findEntity(Name n);
  public final Atom findLoadedNameSpace(Atom url);
  public final Atom findLongNameSpace(Atom as);
  public final Notation findNotation(Name name);
  public final Atom findShortNameSpace(Atom href);
  final public Name getDocType();
  final public Element getSchema();
  static public boolean isReservedNameSpace(Atom n);
  public final Enumeration notationDeclarations();
  final public void save(XMLOutputStream o) throws IOException;
}

This class contains all the Document Type Definition (DTD) information for an XML document.

Constructors

DTD

public DTD();

Creates a new empty DTD.

Methods

addLoadedNameSpace 

public final void addLoadedNameSpace(Atom url);

add a loaded name space name to the list

addNameSpace 

public final void addNameSpace(Atom as, Atom href);

add a pair to the name space hashtable

clear 

final public void clear();

Resets the DTD to its initial state.

Return Value

No return value.

elementDeclarations 

public final Enumeration elementDeclarations();

Retrieves an object for enumerating the element declarations.

Return Value

Returns an >Enumeration object that returns ElementDecl objects when enumerated.

entityDeclarations 

public final Enumeration entityDeclarations();

Return an enumeration for enumerating the entities The enumeration returns entity objects.

findElementDecl 

public final ElementDecl findElementDecl(Name name);

Finds an element declaration for the given tag name.

Return Value

Returns the element declaration object.

ParameterDescription
nameThe tag name.

findEntity 

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.

ParameterDescription
nThe name of the entity.

findLoadedNameSpace 

public final Atom findLoadedNameSpace(Atom url);

keep a list of all name spaces loaded so they are loaded twice if two name spaces happen to refer to the same DTD file

findLongNameSpace 

public final Atom findLongNameSpace(Atom as);

findNotation 

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.

ParameterDescription
nameThe name of the notation.

findShortNameSpace 

public final Atom findShortNameSpace(Atom href);

get the short name of a specified name space

getDocType 

final public Name getDocType();

Retrieves the name specified in the DOCTYPE tag.

Return Value

Returns the name of the document type.

getSchema 

final public Element getSchema();

Convert everything stored in the DTD to schema. (Does not retain original order)

isReservedNameSpace 

static public boolean isReservedNameSpace(Atom n);

notationDeclarations 

public final Enumeration notationDeclarations();

Return an enumeration for enumerating the notations The enumeration returns notation objects.

save 

final public void save(XMLOutputStream o) throws IOException;

Saves the DTD information to the given XML output stream.

Return Value

No return value.

ParameterDescription
oThe output stream to write to.

Exceptions

>IOException if there are problems writing to the output stream.