Package org.ccil.cowan.tagsoup
Class Element
java.lang.Object
org.ccil.cowan.tagsoup.Element
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.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionElement
(ElementType type, boolean defaultAttributes) Return an Element from a specified ElementType. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Make this element anonymous.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
Return true if this element has been preclosed.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.name()
Return the name of the element's type.Return the namespace name of the element's type.next()
Return the next element in an element stack or queue.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
Change the next element in an element stack or queue.type()
Return the element type.
-
Constructor Details
-
Element
Return an Element from a specified ElementType.- Parameters:
type
- The element type of the newly constructed elementdefaultAttributes
- True if default attributes are wanted
-
-
Method Details
-
type
Return the element type.- Returns:
- The element type.
-
atts
Return the attributes as an AttributesImpl object. Returning an AttributesImpl makes the attributes mutable.- Returns:
- The attributes
- See Also:
-
next
Return the next element in an element stack or queue.- Returns:
- The next element
-
setNext
Change the next element in an element stack or queue.- Parameters:
next
- The new next element
-
name
Return the name of the element's type. Convenience method.- Returns:
- The element type name
-
namespace
Return the namespace name of the element's type. Convenience method.- Returns:
- The element type namespace name
-
localName
Return the local name of the element's type. Convenience method.- Returns:
- The element type local name
-
model
public int model()Return the content model vector of the element's type. Convenience method.- Returns:
- The content model vector
-
memberOf
public int memberOf()Return the member-of vector of the element's type. Convenience method.- Returns:
- The member-of vector
-
flags
public int flags()Return the flags vector of the element's type. Convenience method.- Returns:
- The flags vector
-
parent
Return the parent element type of the element's type. Convenience method.- Returns:
- The parent element type
-
canContain
Return true if the type of this element can contain the type of another element. Convenience method.- Parameters:
other
- The other element
-
setAttribute
Set an attribute and its value into this element.- Parameters:
name
- The attribute name (Qname)type
- The attribute typevalue
- The attribute value
-
anonymize
public void anonymize()Make this element anonymous. Remove any id or name attribute present in the element's attributes. -
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. -
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. -
isPreclosed
public boolean isPreclosed()Return true if this element has been preclosed.
-