|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.harvard.hul.ois.jhove.module.html.HtmlTagDesc
public class HtmlTagDesc
This class defines the permitted behavior of a particular HTML tag. The full descriptive power of a DTD description isn't implemented here, but content types and sequences of content are implemented.
Field Summary | |
---|---|
protected int[] |
_sequence
Array controlling the number of times each element of _contentArray may be used. |
static int |
SEQ0_1
Value in _sequence indicating an element may be used 0 or 1 times. |
static int |
SEQ0_MANY
Value in _sequence indicating an element may be used 0 or more times. |
static int |
SEQ1
Value in _sequence indicating an element must be used exactly once. |
static int |
SEQ1_MANY
Value in _sequence indicating an element may be used 1 or more times. |
Constructor Summary | |
---|---|
HtmlTagDesc(java.lang.String name,
boolean openTagRequired,
boolean closeTagRequired,
int[] sequence,
java.util.List[] contentArray,
java.util.List attributes)
Constructor for sequenced case. |
|
HtmlTagDesc(java.lang.String name,
boolean openTagRequired,
boolean closeTagRequired,
java.util.List content,
java.util.List attributes)
Constructor for simple case. |
Method Summary | |
---|---|
void |
addImplicitContainer(HtmlTagDesc container)
Provides the object with an array of element tags in which this element can be nested. |
protected boolean |
allowsPCData()
|
protected boolean |
allowsTag(java.lang.String tag,
HtmlDocDesc doc)
Reports whether this element allows a given tag name in its content. |
protected boolean |
allowsTag(java.lang.String tag,
int index,
HtmlDocDesc doc)
Reports whether this element allows a given tag name in its content, at the specified index. |
protected boolean |
canAdvanceFrom(int index,
int elemCount)
Reports whether it's legal to advance to the next content index. |
protected boolean |
canGetMoreAt(int index,
int elemCount)
Reports whether additional elements can be matched at the specified content index. |
boolean |
excludesTag(java.lang.String tag)
Returns true if a given tag is excluded
within this element. |
protected java.util.List |
implicitContainers(java.lang.String tag)
Reports whether this element can be implicitly nested in an element with a given tag. |
protected boolean |
isCloseTagRequired()
Returns true if the closing tag is required |
protected boolean |
isContentEmpty()
Returns true if this element has empty content |
boolean |
isTemp()
Reports whether this is a temporary tag descriptor. |
boolean |
matches(java.lang.String name)
|
protected java.util.List |
missingRequiredAttributes(java.util.List names)
Accepts a list of attribute names, and returns a List of required attribute names which are not present in the parameter list. |
protected HtmlAttributeDesc |
namedAttDesc(java.lang.String name)
Returns the attribute with a given name, or null if no such attribute is defined for the element |
void |
setAttributes(java.lang.String[] attributeArray)
Alternative way of setting the attribute names. |
void |
setExcludedContent(java.lang.String[] content)
Specifies tags which may not be included in this element or in any element nested at any depth within it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int[] _sequence
public static final int SEQ0_1
public static final int SEQ1
public static final int SEQ1_MANY
public static final int SEQ0_MANY
Constructor Detail |
---|
public HtmlTagDesc(java.lang.String name, boolean openTagRequired, boolean closeTagRequired, java.util.List content, java.util.List attributes)
name
- Name of the elementopenTagRequired
- true
if an opening tag is requiredcloseTagRequired
- true
if a closing tag is requiredcontent
- List of permitted tags. But what do I do when
a particular order is required? Null if element
is defined at EMPTY.attributes
- List of HtmlAttributeDesc elements enumerating
the permitted attributes. May be null, in which
case _attributes will be stored as an empty list.public HtmlTagDesc(java.lang.String name, boolean openTagRequired, boolean closeTagRequired, int[] sequence, java.util.List[] contentArray, java.util.List attributes)
name
- Name of the elementopenTagRequired
- true
if an opening tag is requiredcloseTagRequired
- true
if a closing tag is requiredsequence
- Array indicating the sequencing of elements in
content. Must have the same length
as sequence
.attributes
- List of HtmlAttributeDesc elements enumerating
the permitted attributes. May be null, in which
case _attributes will be stored as an empty list.
Method Detail |
---|
public void setExcludedContent(java.lang.String[] content)
public boolean excludesTag(java.lang.String tag)
true
if a given tag is excluded
within this element. It is necessary to call this
method for each element on the stack to determine if
it is excluded.
public void setAttributes(java.lang.String[] attributeArray)
public void addImplicitContainer(HtmlTagDesc container)
public boolean matches(java.lang.String name)
public boolean isTemp()
false
unless overridden.
protected boolean allowsTag(java.lang.String tag, int index, HtmlDocDesc doc)
protected java.util.List implicitContainers(java.lang.String tag)
protected boolean canGetMoreAt(int index, int elemCount)
protected boolean canAdvanceFrom(int index, int elemCount)
protected boolean allowsTag(java.lang.String tag, HtmlDocDesc doc)
protected boolean allowsPCData()
protected HtmlAttributeDesc namedAttDesc(java.lang.String name)
protected java.util.List missingRequiredAttributes(java.util.List names)
protected boolean isCloseTagRequired()
protected boolean isContentEmpty()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |