edu.northwestern.at.utils.xml

## Class XMLTagClassifier

- java.lang.Object
- - edu.northwestern.at.utils.xml.XMLTagClassifier

- Direct Known Subclasses:
    TEITagClassifier

      public class XMLTagClassifier
      extends java.lang.Object

  XML tag classifier.

  Allows you to classify an XML tag using an arbitrary label. Most of the time the labels represent categories such as "front" or "back" indicating a tag contains front matter or back matter, or "side" indicating a tag contains side matter.

  Also classifies an XML tag as either a hard tag, a soft tag, or a jump tag. A hard tag maintains the reading context but starts a new text section. A jump tag interrupts the reading context as well as starting a new text section. A soft tag neither interrupts the reading context nor starts a new text section.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.Set<java.lang.String>` | `jumpTagsSet` Set of jump tags.
    `protected java.util.Set<java.lang.String>` | `softTagsSet` Set of soft tags.
    `protected java.util.Map<java.lang.String,java.lang.String>` | `tagClasses` Class for tag.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XMLTagClassifier()` Create an XML tag class.
    `XMLTagClassifier(java.lang.String jumpTags, java.lang.String softTags, boolean ignoreCase)` Create an XML tag class.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getTagClass(java.lang.String tag)` Get class for a tag.
    `boolean` | `isHardTag(java.lang.String tag)` Is tag a hard tag?
    `boolean` | `isJumpTag(java.lang.String tag)` Is tag a jump tag?
    `boolean` | `isSoftTag(java.lang.String tag)` Is tag a soft tag?
    `void` | `setJumpTags(java.lang.String[] tags, boolean ignoreCase)` Set the jump tags.
    `void` | `setJumpTags(java.lang.String tags, boolean ignoreCase)` Set the jump tags.
    `void` | `setSoftTags(java.lang.String[] tags, boolean ignoreCase)` Set the soft tags.
    `void` | `setSoftTags(java.lang.String tags, boolean ignoreCase)` Set the soft tags.
    `void` | `setTagClass(java.lang.String tagClass, java.lang.String[] tags, boolean ignoreCase)` Set the tag class names.
    `void` | `setTagClass(java.lang.String tagClass, java.lang.String tags, boolean ignoreCase)` Set the tag class names.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### jumpTagsSet

          protected java.util.Set<java.lang.String> jumpTagsSet

      Set of jump tags.

    - #### softTagsSet

          protected java.util.Set<java.lang.String> softTagsSet

      Set of soft tags.

    - #### tagClasses

          protected java.util.Map<java.lang.String,java.lang.String> tagClasses

      Class for tag.

  - ### Constructor Detail

    - #### XMLTagClassifier

          public XMLTagClassifier()

      Create an XML tag class.

    - #### XMLTagClassifier

          public XMLTagClassifier(java.lang.String jumpTags,
                          java.lang.String softTags,
                          boolean ignoreCase)

      Create an XML tag class.
      Parameters:
        `jumpTags` - String containing jump tags separated by blanks.
        `softTags` - String containing soft tags separated by blanks.
        `ignoreCase` - True to store tag names in lower case.

  - ### Method Detail

    - #### setJumpTags

          public void setJumpTags(java.lang.String tags,
                         boolean ignoreCase)

      Set the jump tags.
      Parameters:
        `tags` - String containing jump tags separated by blanks.
        `ignoreCase` - True to ignore the tag case.

        When "ignoreCase" is true, the tag names are stored and compared as lower case.

    - #### setJumpTags

          public void setJumpTags(java.lang.String[] tags,
                         boolean ignoreCase)

      Set the jump tags.
      Parameters:
        `tags` - String array containing jump tags.
        `ignoreCase` - True to ignore the tag case.

        When "ignoreCase" is true, the tag names are stored and compared as lower case.

    - #### setSoftTags

          public void setSoftTags(java.lang.String tags,
                         boolean ignoreCase)

      Set the soft tags.
      Parameters:
        `tags` - String containing soft tags separated by blanks.
        `ignoreCase` - True to ignore the tag case.

        When "ignoreCase" is true, the tag names are stored and compared as lower case.

    - #### setSoftTags

          public void setSoftTags(java.lang.String[] tags,
                         boolean ignoreCase)

      Set the soft tags.
      Parameters:
        `tags` - String array containing soft tags.
        `ignoreCase` - True to ignore the tag case.

        When "ignoreCase" is true, the tag names are stored and compared as lower case.

    - #### setTagClass

          public void setTagClass(java.lang.String tagClass,
                         java.lang.String[] tags,
                         boolean ignoreCase)

      Set the tag class names.
      Parameters:
        `tagClass` - The tag class.
        `tags` - String array containing tags.
        `ignoreCase` - True to ignore the tag case.

        When "ignoreCase" is true, the tag names are stored and compared as lower case.

    - #### setTagClass

          public void setTagClass(java.lang.String tagClass,
                         java.lang.String tags,
                         boolean ignoreCase)

      Set the tag class names.
      Parameters:
        `tagClass` - The tag class.
        `tags` - String containing tags, separated by blanks.
        `ignoreCase` - True to ignore the tag case.

        When "ignoreCase" is true, the tag names are stored and compared as lower case.

    - #### getTagClass

          public java.lang.String getTagClass(java.lang.String tag)

      Get class for a tag.
      Parameters:
        `tag` - The tag.
      Returns:
        The tag class, or null if tag is not assigned a class.

    - #### isSoftTag

          public boolean isSoftTag(java.lang.String tag)

      Is tag a soft tag?
      Parameters:
        `tag` - The XML tag.
      Returns:
        true if tag is a soft tag.

    - #### isJumpTag

          public boolean isJumpTag(java.lang.String tag)

      Is tag a jump tag?
      Parameters:
        `tag` - The XML tag.
      Returns:
        true if tag is a jump tag.

    - #### isHardTag

          public boolean isHardTag(java.lang.String tag)

      Is tag a hard tag?
      Parameters:
        `tag` - The XML tag.
      Returns:
        true if tag is a hard tag.