public class XMLTagClassifier
extends java.lang.Object
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.
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 and Description |
---|
XMLTagClassifier()
Create an XML tag class.
|
XMLTagClassifier(java.lang.String jumpTags,
java.lang.String softTags,
boolean ignoreCase)
Create an XML tag class.
|
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.
|
protected java.util.Set<java.lang.String> jumpTagsSet
protected java.util.Set<java.lang.String> softTagsSet
protected java.util.Map<java.lang.String,java.lang.String> tagClasses
public XMLTagClassifier()
public XMLTagClassifier(java.lang.String jumpTags, java.lang.String softTags, boolean ignoreCase)
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.public void setJumpTags(java.lang.String tags, boolean ignoreCase)
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.
public void setJumpTags(java.lang.String[] tags, boolean ignoreCase)
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.
public void setSoftTags(java.lang.String tags, boolean ignoreCase)
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.
public void setSoftTags(java.lang.String[] tags, boolean ignoreCase)
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.
public void setTagClass(java.lang.String tagClass, java.lang.String[] tags, boolean ignoreCase)
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.
public void setTagClass(java.lang.String tagClass, java.lang.String tags, boolean ignoreCase)
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.
public java.lang.String getTagClass(java.lang.String tag)
tag
- The tag.public boolean isSoftTag(java.lang.String tag)
tag
- The XML tag.public boolean isJumpTag(java.lang.String tag)
tag
- The XML tag.public boolean isHardTag(java.lang.String tag)
tag
- The XML tag.