Methods Summary |
---|
public AttributesImpl | 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.return theAtts;
|
public boolean | canContain(org.ccil.cowan.tagsoup.ElementType other)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.
return (theModel & other.theMemberOf) != 0;
|
public int | flags()Returns the flags associated with this element type. return theFlags;
|
public java.lang.String | localName(java.lang.String name)Return a local name from a Qname.
int colon = name.indexOf(':");
if (colon == -1) {
return name;
}
else {
return name.substring(colon+1).intern();
}
|
public java.lang.String | localName()Returns the local name of this element type. return theLocalName;
|
public int | memberOf()Returns the content models to which this element type belongs. return theMemberOf;
|
public int | model()Returns the content models of this element type. return theModel;
|
public java.lang.String | name()Returns the name of this element type. return theName;
|
public java.lang.String | namespace(java.lang.String name, boolean attribute)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.
int colon = name.indexOf(':");
if (colon == -1) {
return attribute ? "" : theSchema.getURI();
}
String prefix = name.substring(0, colon);
if (prefix.equals("xml")) {
return "http://www.w3.org/XML/1998/namespace";
}
else {
return ("urn:x-prefix:" + prefix).intern();
}
|
public java.lang.String | namespace()Returns the namespace name of this element type. return theNamespace;
|
public static java.lang.String | normalize(java.lang.String value)Normalize an attribute value (ID-style).
CDATA-style attribute normalization is already done.
if (value == null) return value;
value = value.trim();
if (value.indexOf(" ") == -1) return value;
boolean space = false;
int len = value.length();
StringBuffer b = new StringBuffer(len);
for (int i = 0; i < len; i++) {
char v = value.charAt(i);
if (v == ' ") {
if (!space) b.append(v);
space = true;
}
else {
b.append(v);
space = false;
}
}
return b.toString();
|
public org.ccil.cowan.tagsoup.ElementType | parent()Returns the parent element type of this element type.return theParent;
|
public Schema | schema()Returns the schema which this element type is associated with.return theSchema;
|
public void | setAttribute(AttributesImpl atts, java.lang.String name, java.lang.String type, java.lang.String value)Sets an attribute and its value into an AttributesImpl object.
Attempts to set a namespace declaration are ignored.
if (name.equals("xmlns") || name.startsWith("xmlns:")) {
return;
}
;
String namespace = namespace(name, true);
String localName = localName(name);
int i = atts.getIndex(name);
if (i == -1) {
name = name.intern();
if (type == null) type = "CDATA";
if (!type.equals("CDATA")) value = normalize(value);
atts.addAttribute(namespace, localName, name, type, value);
}
else {
if (type == null) type = atts.getType(i);
if (!type.equals("CDATA")) value=normalize(value);
atts.setAttribute(i, namespace, localName, name, type, value);
}
|
public void | setAttribute(java.lang.String name, java.lang.String type, java.lang.String value)Sets an attribute and its value into this element type.
setAttribute(theAtts, name, type, value);
|
public void | setFlags(int flags)Sets the flags of this element type. theFlags = flags;
|
public void | setMemberOf(int memberOf)Sets the content models to which this element type belongs. theMemberOf = memberOf;
|
public void | setModel(int model)Sets the models of this element type. theModel = model;
|
public void | setParent(org.ccil.cowan.tagsoup.ElementType parent)Sets the parent element type of this element type. theParent = parent;
|