Class Utilities

java.lang.Object
eu.bandm.tools.dtd.Utilities

public class Utilities extends Object
Small helper functions and data.
  • Field Details

    • PUBLIC_IDENTIFIER_OWNER_BANDM

      protected static final String PUBLIC_IDENTIFIER_OWNER_BANDM
      See Also:
    • fpi_mainlevel_separator

      public static final String fpi_mainlevel_separator
      See Also:
    • PUBLIC_IDENTIFIER_PREFIX_BANDM

      public static final String PUBLIC_IDENTIFIER_PREFIX_BANDM
      Since we are a domain owner, we automatically have a *registered* "Formal Public Identifier". (So we have more than w3c !-)
      See Also:
    • attribute_canonicalKey_type_separator

      public static final String attribute_canonicalKey_type_separator
      See Also:
    • prefix_local_anchor

      public static final String prefix_local_anchor
      See Also:
    • PI_TARGET_TDOM

      public static final String PI_TARGET_TDOM
      See Also:
  • Method Details

    • constUrl

      public static final URL constUrl(String c)
      Makes a URL from a constant which is KNOWN to be syntactically correct.
    • notEmptyCheck

      protected static void notEmptyCheck(@Opt @Opt String o, String t)
    • make_formal_public_identifier

      public static final String make_formal_public_identifier(String owner, String fpi_class, String description, String language, @Opt @Opt String version)
      Create a formal public identifier with all the given parameters as its components. Makes something like
        +//IDN bandm.eu//DTD a.b.c.d//en
        or 
        +//IDN bandm.eu//DTD a.b.c.d//en//1.0
        ---------------  Owner        -- language 
                   class ---              --- version
                  description ------
        
      The "charset" format is not supported. The syntax of the values for "owner" and "fpi_class" are not checked. All string values must be non-null and non-empty, except "version", which may be missing.

      Documentation on FPIs is in the user documentation. and in http://en.wikipedia.org/wiki/Formal_Public_Identifier and in http://xml.coverpages.org/tauber-fpi.html

    • make_formal_public_identifier_bandm

      public static final String make_formal_public_identifier_bandm(String fpi_class, String description, String language, @Opt @Opt String version)
      Create a formal public identifier issued by bandm and with all the given parameters further components.
    • make_formal_public_identifier_bandm

      public static final String make_formal_public_identifier_bandm(String fpi_class, String description, String language)
      Create a formal public identifier issued by bandm and with all the given parameters further components.
    • fpi_extractDescription

      @Opt public static @Opt String fpi_extractDescription(String fpi)
      Extracts the underlined part, which is used BY US as a file identifier:
            +//IDN bandm.eu//DTD a/b/c.dtd  //en//1.0
            ISO abc:def    //DTD a/b/c.dtd  //en//1.0
                                 ^^^^^^^^^^^
            
      Returns null in case of error, which includes the epsilon string.
    • canonicalKey_element

      public static final String canonicalKey_element(String name)
      Makes the string used as key into maps/sets which unify different kinds of markup declaration.
    • canonicalKey

      public static final String canonicalKey(DTD.Element element)
      Makes the string used as key into maps/sets which unify different kinds of markup declaration.
    • canonicalKey_attribute

      public static final String canonicalKey_attribute(String name)
      Makes the string used as key into maps/sets which unify different kinds of markup declaration.
    • canonicalKey

      public static final String canonicalKey(DTD.Attlist attribute)
      Makes the string used as key into maps/sets which unify different kinds of markup declaration.
    • canonicalKey_entity

      public static final String canonicalKey_entity(String name, boolean attribute)
      Makes the string used as key into maps/sets which unify different kinds of markup declaration.
    • canonicalKey

      public static final String canonicalKey(DTD.Entity entity)
      Makes the string used as key into maps/sets which unify different kinds of markup declaration.
    • canonicalKey_att_name_type

      public static final String canonicalKey_att_name_type(DTD.AttDef attDef)
      Makes the string used as key into maps/sets which unify different kinds of markup declaration.
    • getAllPiAsString

      public static Set<String> getAllPiAsString(String target, DTD.Dtd dtd)
      Collect the text values of all PIs with a given target. The equality test of the target ignores cases by the java method String.equalsIgnoreCase(String)
    • addTdomPI_documentId

      public static boolean addTdomPI_documentId(DTD.Dtd dtd)
      Add a process instruction to tdom, containing the document id of the Dtd.
      The pi "<?tdom PUBLIC ...?>" allows a dtd to declare its own public and system id. This information will be used by tdom e.g. to insert the dtd-based text type declaration into the printings of model instances. This method inserts such a PI (at position zero of the markup), iff there is an documentId!=null set in the dtd, and no such PI already exists. (So the method is idempotent)
      To our understanding, the SYSTEM part of the id should NEVER be used, because it is redundant and reflects only the "role as a cache" of the local file system. But this is not possible, since the grammar requires it, cf. XMLDocumentIdentifier.toString().
      Returns:
      whether an update on the dtd data is done.
    • quoteAttributeValue

      public static String quoteAttributeValue(String s)