public final class Entity extends Objectimplements DTDConstants
DTD
| Modifier and Type | Field and Description |
|---|---|
char[] |
data
|
String |
name
|
int |
type
|
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| Constructor and Description |
|---|
Entity(String
Creates an entity.
|
| Modifier and Type | Method and Description |
|---|---|
char[] |
getData()
Returns the
data.
|
String |
getName()
Gets the name of the entity.
|
String |
getString()
Returns the data as a
String.
|
int |
getType()
Gets the type of the entity.
|
boolean |
isGeneral()
Returns
true if it is a general entity.
|
boolean |
isParameter()
Returns
true if it is a parameter entity.
|
static int |
name2type(String
Converts
nm string to the corresponding entity type.
|
public Stringname
public int type
public char[] data
public Entity(Stringname, int type, char[] data)
name - the name of the entity
type - the type of the entity
data - the char array of data
public StringgetName()
String
public int getType()
public boolean isParameter()
true if it is a parameter entity.
true if it is a parameter entity
public boolean isGeneral()
true if it is a general entity.
true if it is a general entity
public char[] getData()
data.
data
public StringgetString()
String.
String
public static int name2type(Stringnm)
nm string 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".
nm - the string to be converted