FileDocCategorySizeDatePackage
Element.javaAPI DocJava SE 5 API3110Fri Aug 26 14:58:20 BST 2005javax.swing.text.html.parser

Element

public final class Element extends Object implements Serializable, DTDConstants
An element as described in a DTD using the ELEMENT construct. This is essentiall the description of a tag. It describes the type, content model, attributes, attribute types etc. It is used to correctly parse a document by the Parser.
see
DTD
see
AttributeList
version
1.9, 12/19/03
author
Arthur van Hoff

Fields Summary
public int
index
public String
name
public boolean
oStart
public boolean
oEnd
public BitSet
inclusions
public BitSet
exclusions
public int
type
public ContentModel
content
public AttributeList
atts
static int
maxIndex
public Object
data
A field to store user data. Mostly used to store style sheets.
static Hashtable
contentTypes
Constructors Summary
Element()


     
    
Element(String name, int index)
Create a new element.

	this.name = name;
	this.index = index;
	maxIndex = Math.max(maxIndex, index);
    
Methods Summary
public javax.swing.text.html.parser.AttributeListgetAttribute(java.lang.String name)
Get an attribute by name.

	for (AttributeList a = atts ; a != null ; a = a.next) {
	    if (a.name.equals(name)) {
		return a;
	    }
	}
	return null;
    
public javax.swing.text.html.parser.AttributeListgetAttributeByValue(java.lang.String name)
Get an attribute by value.

	for (AttributeList a = atts ; a != null ; a = a.next) {
	    if ((a.values != null) && a.values.contains(name)) {
		return a;
	    }
	}
	return null;
    
public javax.swing.text.html.parser.AttributeListgetAttributes()
Get the attributes.

	return atts;
    
public javax.swing.text.html.parser.ContentModelgetContent()
Get content model

	return content;
    
public intgetIndex()
Get index.

	return index;
    
public java.lang.StringgetName()
Get the name of the element.

	return name;
    
public intgetType()
Get type.

	return type;
    
public booleanisEmpty()
Check if empty

	return type == EMPTY;
    
public static intname2type(java.lang.String nm)


     
	contentTypes.put("CDATA", new Integer(CDATA));
	contentTypes.put("RCDATA", new Integer(RCDATA));
	contentTypes.put("EMPTY", new Integer(EMPTY));
	contentTypes.put("ANY", new Integer(ANY));
    
	Integer val = (Integer)contentTypes.get(nm);
	return (val != null) ? val.intValue() : 0;
    
public booleanomitEnd()
Return true if the end tag can be omitted.

	return oEnd;
    
public booleanomitStart()
Return true if the start tag can be omitted.

	return oStart;
    
public java.lang.StringtoString()
Convert to a string.

	return name;