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.
    • nullcheck

      protected void nullcheck(@Opt @Opt String o, String t)
    • 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 fip_class, String description, String language, @Opt @Opt String version)
      Makes something like
        +//IDN bandm.eu//DTD a.b.c.d//en
        or 
        +//IDN bandm.eu//DTD a.b.c.d//en//1.0
        
      The "charset" format is not supported. The owner and fip_class syntax are not checked. 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 fip_class, String description, String language, String version)
    • make_formal_public_identifier_bandm

      public static final String make_formal_public_identifier_bandm(String fip_class, String description, String language)
    • fpi_extractDescription

      public static 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
                                 ^^^^^^^^^
            
      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)