public final class Entity extends Object implements 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
Modifier and Type | Method and Description |
---|---|
char[] |
getData()
返回
data 。
|
String |
getName()
获取实体的名称。
|
String |
getString()
返回数据为
String 。
|
int |
getType()
获取实体的类型。
|
boolean |
isGeneral()
如果是一般实体,则返回
true 。
|
boolean |
isParameter()
如果是参数实体,则返回
true 。
|
static int |
name2type(String nm)
将
nm 字符串转换为相应的实体类型。
|
public String name
public int type
public char[] data
public Entity(String name, int type, char[] data)
name
- 实体的名称
type
- 实体的类型
data
- 数据的char数组
public String getName()
String
public int getType()
public boolean isParameter()
true
。
true
如果它是一个参数实体
public boolean isGeneral()
true
。
true
如果是一般实体
public char[] getData()
data
。
data
public String getString()
String
。
String
public static int name2type(String nm)
nm
字符串转换为相应的实体类型。
如果字符串没有相应的实体类型,则返回与“CDATA”对应的类型。
有效的实体类型有:“PUBLIC”,“CDATA”,“SDATA”,“PI”,“STARTTAG”,“ENDTAG”,“MS”,“MD”,“SYSTEM”
nm
- 要转换的字符串