Package org.ccil.cowan.tagsoup
Class ElementType
java.lang.Object
org.ccil.cowan.tagsoup.ElementType
This class represents an element type in the schema.
An element type has a name, a content model vector, a member-of vector,
a flags vector, default attributes, and a schema to which it belongs.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionElementType
(String name, int model, int memberOf, int flags, Schema schema) Construct an ElementType: but it's better to use Schema.element() instead. -
Method Summary
Modifier and TypeMethodDescriptionatts()
Returns the default attributes associated with this element type.boolean
canContain
(ElementType other) Returns true if this element type can contain another element type.int
flags()
Returns the flags associated with this element type.Returns the local name of this element type.Return a local name from a Qname.int
memberOf()
Returns the content models to which this element type belongs.int
model()
Returns the content models of this element type.name()
Returns the name of this element type.Returns the namespace name of this element type.Return a namespace name from a Qname.static String
Normalize an attribute value (ID-style).parent()
Returns the parent element type of this element type.schema()
Returns the schema which this element type is associated with.void
setAttribute
(String name, String type, String value) Sets an attribute and its value into this element type.void
setAttribute
(AttributesImpl atts, String name, String type, String value) Sets an attribute and its value into an AttributesImpl object.void
setFlags
(int flags) Sets the flags of this element type.void
setMemberOf
(int memberOf) Sets the content models to which this element type belongs.void
setModel
(int model) Sets the models of this element type.void
setParent
(ElementType parent) Sets the parent element type of this element type.
-
Constructor Details
-
ElementType
Construct an ElementType: but it's better to use Schema.element() instead. The content model, member-of, and flags vectors are specified as ints.- Parameters:
name
- The element type namemodel
- ORed-together bits representing the content models allowed in the content of this element typememberOf
- ORed-together bits representing the content models to which this element type belongsflags
- ORed-together bits representing the flags associated with this element typeschema
- The schema with which this element type will be associated
-
-
Method Details
-
namespace
Return a namespace name from a Qname. The attribute flag tells us whether to return an empty namespace name if there is no prefix, or use the schema default instead.- Parameters:
name
- The Qnameattribute
- True if name is an attribute name- Returns:
- The namespace name
-
localName
Return a local name from a Qname.- Parameters:
name
- The Qname- Returns:
- The local name
-
name
Returns the name of this element type.- Returns:
- The name of the element type
-
namespace
Returns the namespace name of this element type.- Returns:
- The namespace name of the element type
-
localName
Returns the local name of this element type.- Returns:
- The local name of the element type
-
model
public int model()Returns the content models of this element type.- Returns:
- The content models of this element type as a vector of bits
-
memberOf
public int memberOf()Returns the content models to which this element type belongs.- Returns:
- The content models to which this element type belongs as a vector of bits
-
flags
public int flags()Returns the flags associated with this element type.- Returns:
- The flags associated with this element type as a vector of bits
-
atts
Returns the default attributes associated with this element type. Attributes of type CDATA that don't have default values are typically not included. Other attributes without default values have an internal value of null. The return value is an AttributesImpl to allow the caller to mutate the attributes. -
parent
Returns the parent element type of this element type.- Returns:
- The parent element type
-
schema
Returns the schema which this element type is associated with.- Returns:
- The schema
-
canContain
Returns true if this element type can contain another element type. That is, if any of the models in this element's model vector match any of the models in the other element type's member-of vector.- Parameters:
other
- The other element type
-
setAttribute
Sets an attribute and its value into an AttributesImpl object. Attempts to set a namespace declaration are ignored.- Parameters:
atts
- The AttributesImpl objectname
- The name (Qname) of the attributetype
- The type of the attributevalue
- The value of the attribute
-
normalize
Normalize an attribute value (ID-style). CDATA-style attribute normalization is already done.- Parameters:
value
- The value to normalize- Returns:
- The normalized value
-
setAttribute
Sets an attribute and its value into this element type.- Parameters:
name
- The name of the attributetype
- The type of the attributevalue
- The value of the attribute
-
setModel
public void setModel(int model) Sets the models of this element type.- Parameters:
model
- The content models of this element type as a vector of bits
-
setMemberOf
public void setMemberOf(int memberOf) Sets the content models to which this element type belongs.- Parameters:
memberOf
- The content models to which this element type belongs as a vector of bits
-
setFlags
public void setFlags(int flags) Sets the flags of this element type.- Parameters:
flags
- associated with this element type The flags as a vector of bits
-
setParent
Sets the parent element type of this element type.- Parameters:
parent
- The parent element type
-