Class pmr.sgml.DTD
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class pmr.sgml.DTD

java.lang.Object
   |
   +----pmr.sgml.DTD

public class DTD
extends Object
class DTD DTD contains GIs which can have properties associated with them, e.g. for rendering. DTDs can contain other DTDs - and all the GIs are available to the top DTD (recursively).

It's fairly horrid. Called like this:
DTD dtd = new DTD("MYDTD"); // MYDTD is name or DTD
This checks to see if MYDTD is already in system - if so does nothing Else it creates MYDTD and all its children DTDs (if any).

NOTE. Each DTD is supported by a hardcoded call to its name within these routines, e.g.
DTD dtd = new MYDTD(); This is because the routines have to be hardcoded for each DTD. If a DTD has no routines, then it need not go through this. These hardcoded DTDs are instantiated, but NOT used by the program for anything else.

There is one hardcoded DTD - HTML. All the rest are dynamically loaded. At present you have to read the code - I'll explain later.

Author:
(C) P. Murray-Rust, 1996

Variable Index

 o doctypeString

Constructor Index

 o DTD()
this constructor should only be used by subclasses
 o DTD(String)
construct a DTD; including all its contained DTDs (recursively).

Method Index

 o addDTDName(String)
adds a DTD - ignores it if already present and gives no message (but returns false)
 o addGIs(StringSet)
 o createSubclassedNode(String, SGMLTree)
creates a new SGMLNode of the appropriate Subclass (if it exists).
 o debug()
 o exists(String)
does a DTD exist in the DTDNameSet?
 o getClassnameFromDTD(String)
 o getDoctypeString()
get the DOCTYPE info (less the tags)
 o getDoctypeString(String)
set the DOCTYPE info (less the tags)
 o getDTD(String)
gets the DTD Object for a given name
 o getDTDName()
the DTD name
 o getDTDNameSet()
returns the Set of all the DTD Names
 o getDTDObj(String)
get a DTD by name (required for subclassed objects
 o getGICount()
the number of GIs in the DTD
 o getGIHashedVector()
returns a HashedVector of the GIs in this DTD
 o getGINames()
 o getGINameSet()
returns a StringSet of the GIs in this DTD
 o getTotalGIHashedVector()
returns the Set of all the GIs
 o indexOf(String)
 o isAliased(String)
returns unaliased GI name ("" if not found)
 o locateClassDirectory(String)
locate CLASS directory which contains a given class (may be superseded by the catalog mechanism).
 o makeAndAddGIs(String[])
create GI and add to current list, also to complete GI list.
 o usingAliasGIs()

Variables

 o doctypeString
  protected String doctypeString

Constructors

 o DTD
  protected DTD()
this constructor should only be used by subclasses
 o DTD
  public DTD(String dName) throws ClassNotFoundException
construct a DTD; including all its contained DTDs (recursively). Check that there are no duplicate GIs. For dynamic loading we need a fully qualified dtdName (e.g. pmr.sgml.PLAY). We'll try to hack this as we develop this.
Throws: ClassNotFoundException
cannot find a file of the form MYDTD.class to use with this DTD.

Methods

 o getGIHashedVector
  public HashedVector getGIHashedVector()
returns a HashedVector of the GIs in this DTD
 o getGINameSet
  public StringSet getGINameSet()
returns a StringSet of the GIs in this DTD
 o getDTDName
  public String getDTDName()
the DTD name
 o getDoctypeString
  public void getDoctypeString(String dt)
set the DOCTYPE info (less the tags)
 o getDoctypeString
  public String getDoctypeString()
get the DOCTYPE info (less the tags)
 o getGICount
  public int getGICount()
the number of GIs in the DTD
 o getGINames
  public String[] getGINames()
 o getTotalGIHashedVector
  public static HashedVector getTotalGIHashedVector()
returns the Set of all the GIs
 o getDTDNameSet
  public static StringSet getDTDNameSet()
returns the Set of all the DTD Names
 o getDTD
  public static DTD getDTD(String dtdName)
gets the DTD Object for a given name
 o exists
  public static boolean exists(String dtdName)
does a DTD exist in the DTDNameSet?
 o getDTDObj
  public static DynamicDTD getDTDObj(String dtdName)
get a DTD by name (required for subclassed objects
 o createSubclassedNode
  public static SGMLNode createSubclassedNode(String giName,
                                              SGMLTree tree)
creates a new SGMLNode of the appropriate Subclass (if it exists). Thus if giName == "MOL", a SGMLNode of class MOL will be created. If there is a generic nodeClass, that may be returned, e.g. if giName == "LI" a SGMLNode of class HTMLNode will be returned. If no match is found, a simple 'SGMLNode' will be returned :-)

This is extremely messy if several DTDs are used at the same time and they have clashing GIs. This is formally not allowed, but we try to survive with HTML but putting it at the bottom (so that other DTDs take precedence with their tags

 o indexOf
  public int indexOf(String giName)
 o addDTDName
  protected boolean addDTDName(String dtdName)
adds a DTD - ignores it if already present and gives no message (but returns false)
 o addGIs
  public void addGIs(StringSet giNameSet)
 o makeAndAddGIs
  public void makeAndAddGIs(String giNames[])
create GI and add to current list, also to complete GI list. at present GI is made from name only, but later we can add attribute lists, etc.

inherited by subclass DTDs

 o usingAliasGIs
  public boolean usingAliasGIs()
 o isAliased
  public boolean isAliased(String giName)
returns unaliased GI name ("" if not found)
 o locateClassDirectory
  public static String locateClassDirectory(String className)
locate CLASS directory which contains a given class (may be superseded by the catalog mechanism). We assume that the DTD has a class of the form MYDTD.class located either under one of the components of CLASSPATH. Thus a DTD like PLAY could be found in /usr/local/java/pmr/classes/local/sgml/play/PLAY.class. or CML in /usr/local/java/pmr/classes/pmr/cml/CML.class

Experimental!!

 o getClassnameFromDTD
  public static String getClassnameFromDTD(String dtdName)
 o debug
  public void debug()

All Packages  Class Hierarchy  This Package  Previous  Next  Index