sigmlgen
Class HSDocParameters

java.lang.Object
  extended by sigmlgen.HSDocParameters

public class HSDocParameters
extends java.lang.Object

Provides standard definitions of various global parameters for HML and SiGML documents, such as encoding, DTD system ID, and document element type, and defines class methods that form prefixes and suffices for HML/SiGML documents, in accordance with the values of these parameters.


Field Summary
static java.lang.String SIGML_BASE_URI_ALT
          Alternative base URI for SiGML.
static java.lang.String SIGML_BASE_URI_STD
          (De facto) Standard base URI for SiGML -- at UEA.
static java.lang.String STD_HML_PREFIX
          Standard HML document prefix, as a (multi-line) string.
static java.lang.String STD_HML_SUFFIX
          Standard HML document suffix, as a (single-line) string.
static java.lang.String STD_SIGML_PREFIX
          Standard SiGML document prefix, as a (multi-line) string.
static java.lang.String STD_SIGML_SUFFIX
          Standard SiGML document suffix, as a (single-line) string.
 
Constructor Summary
HSDocParameters()
           
 
Method Summary
static java.lang.String getEncoding(java.lang.String enc)
          Returns the given encoding if it is non-null, or the standard XML encoding otherwise.
static java.lang.String getH2SDocURI(java.lang.String h2sd)
          Returns the given HML-to-SiGML XSLT transform URI (for a whole HML document), or the standard one otherwise.
static java.lang.String getH2SSignsURI(java.lang.String h2ss)
          Returns the given HML-to-SiGML XSLT transform URI (for a single HML sign), or the standard one otherwise.
static java.lang.String getHMLDTD(java.lang.String hdtd)
          Returns the given HML DTD system ID string if it is non-null, or the standard one otherwise.
static java.lang.String getHMLHeader(java.lang.String htag)
          Returns the HML header for the standard encoding and HML DTD system ID and the given document element tag, in the form of a multi-line string; the header consists of the XML and document type declarations.
static java.lang.String getHMLHeader(java.lang.String henc, java.lang.String hdtd, java.lang.String htag)
          Returns the HML header for the given encoding, HML DTD system ID and document element tag, as a multi-line string; the header consists of the XML and document type declarations.
static java.lang.String getHMLPrefix(java.lang.String henc, java.lang.String hdtd, java.lang.String htag)
          Returns the HML prefix for the given encoding, HML DTD system ID and document element tag, as defined for getHMLPrefixLines(String,String,String), in the form of a single (multi-line) string.
static java.lang.String[] getHMLPrefixLines(java.lang.String henc, java.lang.String hdtd, java.lang.String htag)
          Returns the sequence of HML document prefix lines for a document with the given encoding, DTD system ID and document element tag.
static java.lang.String getHMLSuffix(java.lang.String htag)
          Returns the HML suffix for the given HML document element tag, as defined for getHMLSuffixLine(String), in the form of a one-line string including a line terminator.
static java.lang.String[] getHMLSuffixLine(java.lang.String htag)
          Returns the sequence of HML document suffix lines (actually a singleton sequence) for a document with the given document element tag, or the standard HML document element tag if the given value is null.
static java.lang.String getHMLTag(java.lang.String htag)
          Returns the given HML element tag if it is non-null, or the standard HML element otherwise.
static java.lang.String getSiGMLDTD(java.lang.String sdtd)
          Returns the given SiGML DTD system ID string if it is non-null, or the standard one otherwise.
static java.lang.String getSiGMLHeader(java.lang.String stag)
          Returns the SiGML header for the standard encoding and SiGML DTD system ID and the given document element tag, in the form of a multi-line string; the header consists of the XML and document type declarations.
static java.lang.String getSiGMLHeader(java.lang.String senc, java.lang.String sdtd, java.lang.String stag)
          Returns the SiGML header for the given encoding, SiGML DTD system ID and document element tag, as a multi-line string; the header consists of the XML and document type declarations.
static java.lang.String getSiGMLPrefix(java.lang.String stag)
          Returns the SiGML preix for the given SiGML document element tag, as defined for getSiGMLPrefixLines(String,String,String), in the form of a one-line string including a line terminator.
static java.lang.String getSiGMLPrefix(java.lang.String senc, java.lang.String sdtd, java.lang.String stag)
          Returns the SiGML prefix for the given encoding, SiGML DTD system ID and document element tag, as defined for getSiGMLPrefixLines(String,String,String), in the form of a single (multi-line) string.
static java.lang.String[] getSiGMLPrefixLines(java.lang.String senc, java.lang.String sdtd, java.lang.String stag)
          Returns the sequence of SiGML document prefix lines for a document with the given encoding, DTD system ID and document element tag.
static java.lang.String getSiGMLSuffix(java.lang.String stag)
          Returns the SiGML suffix for the given SiGML document element tag, as defined for getSiGMLSuffixLine(String), in the form of a one-line string including a line terminator.
static java.lang.String[] getSiGMLSuffixLine(java.lang.String stag)
          Returns the sequence of SiGML document suffix lines (actually a singleton sequence) for a document with the given document element tag, or the standard HML document element tag if the given value is null.
static java.lang.String getSiGMLTag(java.lang.String stag)
          Returns the given SiGML element tag if it is non-null, or the standard SiGML element otherwise.
static java.lang.String getSiGMLXMLDecl(java.lang.String senc)
          Returns the SiGML XML declaration line (with EOL) for the given endocding.
static java.lang.String wrapHMLDocBodyEls(java.lang.String bodyels)
          Returns the string given by putting the wrapping the given HML document body text with the standard HML prefix and suffix, with prefix and suffix defined as for getHMLPrefixLines(String,String,String) and getHMLSuffix(String),
static java.lang.String wrapSiGMLDocBodyEls(java.lang.String bodyels)
          Returns the string given by putting the wrapping the given SiGML document body text with the standard SiGML prefix and suffix, with prefix and suffix defined as for getSiGMLPrefixLines(String,String,String) and getSiGMLSuffix(String),
static void writeHMLPrefix(java.io.OutputStream hmls, java.lang.String henc, java.lang.String hdtd, java.lang.String htag)
          Constructs an HML document prefix for the given encoding, DTD system ID and document element tag, using the standard value in each case if the given value is null, and writes the result to the given output stream, using the specified encoding.
static void writeHMLSuffix(java.io.OutputStream hmls, java.lang.String henc, java.lang.String htag)
          Constructs an HML document suffix for the given encoding and document element tag, using the standard value in each case if the given value is null, and writes the result to the given output stream, using the specified encoding.
static void writeSiGMLPrefix(java.io.OutputStream sigmls, java.lang.String senc, java.lang.String sdtd, java.lang.String stag)
          Constructs a SiGML document prefix for the given encoding, DTD system ID and document element tag, using the standard value in each case if the given value is null, and writes the result to the given output stream, using the specified encoding.
static void writeSiGMLSuffix(java.io.OutputStream sigmls, java.lang.String senc, java.lang.String stag)
          Constructs a SiGML document suffix for the given encoding and document element tag, using the standard value in each case if the given value is null, and writes the result to the given output stream, using the specified encoding.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIGML_BASE_URI_STD

public static final java.lang.String SIGML_BASE_URI_STD
(De facto) Standard base URI for SiGML -- at UEA.

See Also:
Constant Field Values

SIGML_BASE_URI_ALT

public static final java.lang.String SIGML_BASE_URI_ALT
Alternative base URI for SiGML.

See Also:
Constant Field Values

STD_HML_PREFIX

public static final java.lang.String STD_HML_PREFIX
Standard HML document prefix, as a (multi-line) string.


STD_HML_SUFFIX

public static final java.lang.String STD_HML_SUFFIX
Standard HML document suffix, as a (single-line) string.


STD_SIGML_PREFIX

public static final java.lang.String STD_SIGML_PREFIX
Standard SiGML document prefix, as a (multi-line) string.


STD_SIGML_SUFFIX

public static final java.lang.String STD_SIGML_SUFFIX
Standard SiGML document suffix, as a (single-line) string.

Constructor Detail

HSDocParameters

public HSDocParameters()
Method Detail

getEncoding

public static final java.lang.String getEncoding(java.lang.String enc)
Returns the given encoding if it is non-null, or the standard XML encoding otherwise.


getHMLTag

public static final java.lang.String getHMLTag(java.lang.String htag)
Returns the given HML element tag if it is non-null, or the standard HML element otherwise.


getSiGMLTag

public static final java.lang.String getSiGMLTag(java.lang.String stag)
Returns the given SiGML element tag if it is non-null, or the standard SiGML element otherwise.


getHMLDTD

public static final java.lang.String getHMLDTD(java.lang.String hdtd)
Returns the given HML DTD system ID string if it is non-null, or the standard one otherwise.


getSiGMLDTD

public static final java.lang.String getSiGMLDTD(java.lang.String sdtd)
Returns the given SiGML DTD system ID string if it is non-null, or the standard one otherwise.


getH2SDocURI

public static final java.lang.String getH2SDocURI(java.lang.String h2sd)
Returns the given HML-to-SiGML XSLT transform URI (for a whole HML document), or the standard one otherwise.


getH2SSignsURI

public static final java.lang.String getH2SSignsURI(java.lang.String h2ss)
Returns the given HML-to-SiGML XSLT transform URI (for a single HML sign), or the standard one otherwise.


writeHMLPrefix

public static void writeHMLPrefix(java.io.OutputStream hmls,
                                  java.lang.String henc,
                                  java.lang.String hdtd,
                                  java.lang.String htag)
                           throws java.io.IOException
Constructs an HML document prefix for the given encoding, DTD system ID and document element tag, using the standard value in each case if the given value is null, and writes the result to the given output stream, using the specified encoding. The prefix is as defined for getHMLPrefixLines(String,String,String).

Throws:
java.io.IOException

writeHMLSuffix

public static void writeHMLSuffix(java.io.OutputStream hmls,
                                  java.lang.String henc,
                                  java.lang.String htag)
                           throws java.io.IOException
Constructs an HML document suffix for the given encoding and document element tag, using the standard value in each case if the given value is null, and writes the result to the given output stream, using the specified encoding. The document suffix consists of the closing tag for the document element.

Throws:
java.io.IOException

wrapHMLDocBodyEls

public static java.lang.String wrapHMLDocBodyEls(java.lang.String bodyels)
Returns the string given by putting the wrapping the given HML document body text with the standard HML prefix and suffix, with prefix and suffix defined as for getHMLPrefixLines(String,String,String) and getHMLSuffix(String),


getHMLHeader

public static java.lang.String getHMLHeader(java.lang.String htag)
Returns the HML header for the standard encoding and HML DTD system ID and the given document element tag, in the form of a multi-line string; the header consists of the XML and document type declarations. If the given tag is null then the standard HML document element tag is used.


getHMLHeader

public static java.lang.String getHMLHeader(java.lang.String henc,
                                            java.lang.String hdtd,
                                            java.lang.String htag)
Returns the HML header for the given encoding, HML DTD system ID and document element tag, as a multi-line string; the header consists of the XML and document type declarations. In each case, if the given value is null then the standard value is used.


getHMLPrefix

public static java.lang.String getHMLPrefix(java.lang.String henc,
                                            java.lang.String hdtd,
                                            java.lang.String htag)
Returns the HML prefix for the given encoding, HML DTD system ID and document element tag, as defined for getHMLPrefixLines(String,String,String), in the form of a single (multi-line) string.


getHMLSuffix

public static java.lang.String getHMLSuffix(java.lang.String htag)
Returns the HML suffix for the given HML document element tag, as defined for getHMLSuffixLine(String), in the form of a one-line string including a line terminator.


getHMLPrefixLines

public static java.lang.String[] getHMLPrefixLines(java.lang.String henc,
                                                   java.lang.String hdtd,
                                                   java.lang.String htag)
Returns the sequence of HML document prefix lines for a document with the given encoding, DTD system ID and document element tag. In each case, if the given value is null then the standard value is used. The prefix consists of the XML declaration, the document type declaration and the document element start tag.


getHMLSuffixLine

public static java.lang.String[] getHMLSuffixLine(java.lang.String htag)
Returns the sequence of HML document suffix lines (actually a singleton sequence) for a document with the given document element tag, or the standard HML document element tag if the given value is null. The suffix just consists of the end tag for the document element.


writeSiGMLPrefix

public static void writeSiGMLPrefix(java.io.OutputStream sigmls,
                                    java.lang.String senc,
                                    java.lang.String sdtd,
                                    java.lang.String stag)
                             throws java.io.IOException
Constructs a SiGML document prefix for the given encoding, DTD system ID and document element tag, using the standard value in each case if the given value is null, and writes the result to the given output stream, using the specified encoding. The prefix is as defined for getSiGMLPrefixLines(String,String,String).

Throws:
java.io.IOException

writeSiGMLSuffix

public static void writeSiGMLSuffix(java.io.OutputStream sigmls,
                                    java.lang.String senc,
                                    java.lang.String stag)
                             throws java.io.IOException
Constructs a SiGML document suffix for the given encoding and document element tag, using the standard value in each case if the given value is null, and writes the result to the given output stream, using the specified encoding. The document suffix consists of the closing tag for the document element.

Throws:
java.io.IOException

wrapSiGMLDocBodyEls

public static java.lang.String wrapSiGMLDocBodyEls(java.lang.String bodyels)
Returns the string given by putting the wrapping the given SiGML document body text with the standard SiGML prefix and suffix, with prefix and suffix defined as for getSiGMLPrefixLines(String,String,String) and getSiGMLSuffix(String),


getSiGMLXMLDecl

public static java.lang.String getSiGMLXMLDecl(java.lang.String senc)
Returns the SiGML XML declaration line (with EOL) for the given endocding.


getSiGMLHeader

public static java.lang.String getSiGMLHeader(java.lang.String stag)
Returns the SiGML header for the standard encoding and SiGML DTD system ID and the given document element tag, in the form of a multi-line string; the header consists of the XML and document type declarations. If the given tag is null then the standard SiGML document element tag is used.


getSiGMLHeader

public static java.lang.String getSiGMLHeader(java.lang.String senc,
                                              java.lang.String sdtd,
                                              java.lang.String stag)
Returns the SiGML header for the given encoding, SiGML DTD system ID and document element tag, as a multi-line string; the header consists of the XML and document type declarations. In each case, if the given value is null then the standard value is used.


getSiGMLPrefix

public static java.lang.String getSiGMLPrefix(java.lang.String senc,
                                              java.lang.String sdtd,
                                              java.lang.String stag)
Returns the SiGML prefix for the given encoding, SiGML DTD system ID and document element tag, as defined for getSiGMLPrefixLines(String,String,String), in the form of a single (multi-line) string.


getSiGMLPrefix

public static java.lang.String getSiGMLPrefix(java.lang.String stag)
Returns the SiGML preix for the given SiGML document element tag, as defined for getSiGMLPrefixLines(String,String,String), in the form of a one-line string including a line terminator.


getSiGMLSuffix

public static java.lang.String getSiGMLSuffix(java.lang.String stag)
Returns the SiGML suffix for the given SiGML document element tag, as defined for getSiGMLSuffixLine(String), in the form of a one-line string including a line terminator.


getSiGMLPrefixLines

public static java.lang.String[] getSiGMLPrefixLines(java.lang.String senc,
                                                     java.lang.String sdtd,
                                                     java.lang.String stag)
Returns the sequence of SiGML document prefix lines for a document with the given encoding, DTD system ID and document element tag. In each case, if the given value is null then the standard value is used. The prefix consists of the XML declaration, the document type declaration and the document element start tag.


getSiGMLSuffixLine

public static java.lang.String[] getSiGMLSuffixLine(java.lang.String stag)
Returns the sequence of SiGML document suffix lines (actually a singleton sequence) for a document with the given document element tag, or the standard HML document element tag if the given value is null. The suffix just consists of the end tag for the document element.