- java.lang.Object
-
- javax.swing.text.html.parser.Entity
-
- All Implemented Interfaces:
DTDConstants
public final class Entity extends Object implements DTDConstants
An entity is described in a DTD using the ENTITY construct. It defines the type and value of the entity.- See Also:
DTD
-
-
Field Summary
Fields Modifier and Type Field Description char[]dataThe char array of data.StringnameThe name of the entity.inttypeThe type of the entity.-
Fields declared in interface javax.swing.text.html.parser.DTDConstants
ANY, CDATA, CONREF, CURRENT, DEFAULT, EMPTY, ENDTAG, ENTITIES, ENTITY, FIXED, GENERAL, ID, IDREF, IDREFS, IMPLIED, MD, MODEL, MS, NAME, NAMES, NMTOKEN, NMTOKENS, NOTATION, NUMBER, NUMBERS, NUTOKEN, NUTOKENS, PARAMETER, PI, PUBLIC, RCDATA, REQUIRED, SDATA, STARTTAG, SYSTEM
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description char[]getData()Returns thedata.StringgetName()Gets the name of the entity.StringgetString()Returns the data as aString.intgetType()Gets the type of the entity.booleanisGeneral()Returnstrueif it is a general entity.booleanisParameter()Returnstrueif it is a parameter entity.static intname2type(String nm)Convertsnmstring to the corresponding entity type.
-
-
-
Field Detail
-
name
public String name
The name of the entity.
-
type
public int type
The type of the entity.
-
data
public char[] data
The char array of data.
-
-
Constructor Detail
-
Entity
public Entity(String name, int type, char[] data)
Creates an entity.- Parameters:
name- the name of the entitytype- the type of the entitydata- the char array of data
-
-
Method Detail
-
getName
public String getName()
Gets the name of the entity.- Returns:
- the name of the entity, as a
String
-
getType
public int getType()
Gets the type of the entity.- Returns:
- the type of the entity
-
isParameter
public boolean isParameter()
Returnstrueif it is a parameter entity.- Returns:
trueif it is a parameter entity
-
isGeneral
public boolean isGeneral()
Returnstrueif it is a general entity.- Returns:
trueif it is a general entity
-
getData
public char[] getData()
Returns thedata.- Returns:
- the
data
-
getString
public String getString()
Returns the data as aString.- Returns:
- the data as a
String
-
name2type
public static int name2type(String nm)
Convertsnmstring to the corresponding entity type. If the string does not have a corresponding entity type, returns the type corresponding to "CDATA". Valid entity types are: "PUBLIC", "CDATA", "SDATA", "PI", "STARTTAG", "ENDTAG", "MS", "MD", "SYSTEM".- Parameters:
nm- the string to be converted- Returns:
- the corresponding entity type, or the type corresponding to "CDATA", if none exists
-
-