public class HtmlTagDesc extends Object
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
HtmlTagDesc(String name,
boolean openTagRequired,
boolean closeTagRequired,
int[] sequence,
List[] contentArray,
List attributes)
Constructor for sequenced case.
|
HtmlTagDesc(String name,
boolean openTagRequired,
boolean closeTagRequired,
List content,
List attributes)
Constructor for simple case.
|
Modifier and Type | Method and Description |
---|---|
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(String tag,
HtmlDocDesc doc)
Reports whether this element allows a given tag name
in its content.
|
protected boolean |
allowsTag(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(String tag)
Returns
true if a given tag is excluded
within this element. |
protected List |
implicitContainers(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(String name) |
protected List |
missingRequiredAttributes(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(String name)
Returns the attribute with a given name, or null if
no such attribute is defined for the element
|
void |
setAttributes(String[] attributeArray)
Alternative way of setting the attribute names.
|
void |
setExcludedContent(String[] content)
Specifies tags which may not be included in this
element or in any element nested at any depth
within it.
|
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
public HtmlTagDesc(String name, boolean openTagRequired, boolean closeTagRequired, List content, 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(String name, boolean openTagRequired, boolean closeTagRequired, int[] sequence, List[] contentArray, 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.public void setExcludedContent(String[] content)
public boolean excludesTag(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(String[] attributeArray)
public void addImplicitContainer(HtmlTagDesc container)
public boolean matches(String name)
public boolean isTemp()
false
unless overridden.protected boolean allowsTag(String tag, int index, HtmlDocDesc doc)
protected List implicitContainers(String tag)
protected boolean canGetMoreAt(int index, int elemCount)
protected boolean canAdvanceFrom(int index, int elemCount)
protected boolean allowsTag(String tag, HtmlDocDesc doc)
protected boolean allowsPCData()
protected HtmlAttributeDesc namedAttDesc(String name)
protected List missingRequiredAttributes(List names)
protected boolean isCloseTagRequired()
protected boolean isContentEmpty()
Copyright © 2008–2017 The Open Preservation Foundation. All rights reserved.