org.ccil.cowan.tagsoup

Class Element

public class Element extends 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.

See Also: ElementType AttributesImpl

Constructor Summary
Element(ElementType type, boolean defaultAttributes)
Return an Element from a specified ElementType.
Method Summary
voidanonymize()
Make this element anonymous.
AttributesImplatts()
Return the attributes as an AttributesImpl object.
booleancanContain(Element other)
Return true if the type of this element can contain the type of another element.
voidclean()
Clean the attributes of this element.
intflags()
Return the flags vector of the element's type.
booleanisPreclosed()
Return true if this element has been preclosed.
StringlocalName()
Return the local name of the element's type.
intmemberOf()
Return the member-of vector of the element's type.
intmodel()
Return the content model vector of the element's type.
Stringname()
Return the name of the element's type.
Stringnamespace()
Return the namespace name of the element's type.
Elementnext()
Return the next element in an element stack or queue.
ElementTypeparent()
Return the parent element type of the element's type.
voidpreclose()
Force this element to preclosed status, meaning that an end-tag has been seen but the element cannot yet be closed for structural reasons.
voidsetAttribute(String name, String type, String value)
Set an attribute and its value into this element.
voidsetNext(Element next)
Change the next element in an element stack or queue.
ElementTypetype()
Return the element type.

Constructor Detail

Element

public Element(ElementType type, boolean defaultAttributes)
Return an Element from a specified ElementType.

Parameters: type The element type of the newly constructed element defaultAttributes True if default attributes are wanted

Method Detail

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.

Returns: The attributes

See Also: AttributesImpl

canContain

public boolean canContain(Element other)
Return true if the type of this element can contain the type of another element. Convenience method.

Parameters: 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. Type BOOLEAN is changed to type NMTOKEN at this time.

flags

public int flags()
Return the flags vector of the element's type. Convenience method.

Returns: The flags vector

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.

Returns: The element type local name

memberOf

public int memberOf()
Return the member-of vector of the element's type. Convenience method.

Returns: The member-of vector

model

public int model()
Return the content model vector of the element's type. Convenience method.

Returns: The content model vector

name

public String name()
Return the name of the element's type. Convenience method.

Returns: The element type name

namespace

public String namespace()
Return the namespace name of the element's type. Convenience method.

Returns: The element type namespace name

next

public Element next()
Return the next element in an element stack or queue.

Returns: The next element

parent

public ElementType parent()
Return the parent element type of the element's type. Convenience method.

Returns: The parent element type

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.

Parameters: name The attribute name (Qname) type The attribute type value The attribute value

setNext

public void setNext(Element next)
Change the next element in an element stack or queue.

Parameters: next The new next element

type

public ElementType type()
Return the element type.

Returns: The element type.

Licence: Academic Free License 3.0 and/or GPL 2.0