org.ccil.cowan.tagsoup
Class Element
java.lang.Object
org.ccil.cowan.tagsoup.Element
public class Element
extends java.lang.Object
The internal representation of an actual element (not an element type).
An Element has an element type, attributes, and a successor Element
for use in constructing stacks and queues of Elements.
Element(ElementType type, boolean defaultAttributes) - Return an Element from a specified ElementType.
|
void | anonymize() - Make this element anonymous.
|
AttributesImpl | atts() - Return the attributes as an AttributesImpl object.
|
boolean | canContain(Element other) - Return true if the type of this element can contain the type of
another element.
|
void | clean() - Clean the attributes of this element.
|
int | flags() - Return the flags vector of the element's type.
|
boolean | isPreclosed() - Return true if this element has been preclosed.
|
String | localName() - Return the local name of the element's type.
|
int | memberOf() - Return the member-of vector of the element's type.
|
int | model() - Return the content model vector of the element's type.
|
String | name() - Return the name of the element's type.
|
String | namespace() - Return the namespace name of the element's type.
|
Element | next() - Return the next element in an element stack or queue.
|
ElementType | parent() - Return the parent element type of the element's type.
|
void | preclose() - Force this element to preclosed status, meaning that an end-tag has
been seen but the element cannot yet be closed for structural reasons.
|
void | setAttribute(String name, String type, String value) - Set an attribute and its value into this element.
|
void | setNext(Element next) - Change the next element in an element stack or queue.
|
ElementType | type() - Return the element type.
|
Element
public Element(ElementType type,
boolean defaultAttributes)
Return an Element from a specified ElementType.
type
- The element type of the newly constructed elementdefaultAttributes
- True if default attributes are wanted
anonymize
public void anonymize()
Make this element anonymous.
Remove any id or name attribute present
in the element's attributes.
atts
public AttributesImpl atts()
Return the attributes as an AttributesImpl object.
Returning an AttributesImpl makes the attributes mutable.
canContain
public boolean canContain(Element other)
Return true if the type of this element can contain the type of
another element.
Convenience method.
other
- The other element
clean
public void clean()
Clean the attributes of this element.
Attributes with null name (the name was ill-formed)
or null value (the attribute was present in the element type but
not in this actual element) are removed.
flags
public int flags()
Return the flags vector of the element's type.
Convenience method.
isPreclosed
public boolean isPreclosed()
Return true if this element has been preclosed.
localName
public String localName()
Return the local name of the element's type.
Convenience method.
- The element type local name
memberOf
public int memberOf()
Return the member-of vector of the element's type.
Convenience method.
model
public int model()
Return the content model vector of the element's type.
Convenience method.
name
public String name()
Return the name of the element's type.
Convenience method.
namespace
public String namespace()
Return the namespace name of the element's type.
Convenience method.
- The element type namespace name
next
public Element next()
Return the next element in an element stack or queue.
parent
public ElementType parent()
Return the parent element type of the element's type.
Convenience method.
preclose
public void preclose()
Force this element to preclosed status, meaning that an end-tag has
been seen but the element cannot yet be closed for structural reasons.
setAttribute
public void setAttribute(String name,
String type,
String value)
Set an attribute and its value into this element.
name
- The attribute name (Qname)type
- The attribute typevalue
- The attribute value
setNext
public void setNext(Element next)
Change the next element in an element stack or queue.
next
- The new next element
Licence: Academic Free License 3.0 and/or GPL 2.0