Entitypublic final class Entity extends Object implements DTDConstantsAn entity is described in a DTD using the ENTITY construct.
It defines the type and value of the the entity. |
Fields Summary |
---|
public String | name | public int | type | public char[] | data | static Hashtable | entityTypes |
Constructors Summary |
---|
public Entity(String name, int type, char[] data)Creates an entity.
this.name = name;
this.type = type;
this.data = data;
|
Methods Summary |
---|
public char[] | getData()Returns the data .
return data;
| public java.lang.String | getName()Gets the name of the entity.
return name;
| public java.lang.String | getString()Returns the data as a String .
return new String(data, 0, data.length);
| public int | getType()Gets the type of the entity.
return type & 0xFFFF;
| public boolean | isGeneral()Returns true if it is a general entity.
return (type & GENERAL) != 0;
| public boolean | isParameter()Returns true if it is a parameter entity.
return (type & PARAMETER) != 0;
| public static int | name2type(java.lang.String nm)Converts 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".
entityTypes.put("PUBLIC", new Integer(PUBLIC));
entityTypes.put("CDATA", new Integer(CDATA));
entityTypes.put("SDATA", new Integer(SDATA));
entityTypes.put("PI", new Integer(PI));
entityTypes.put("STARTTAG", new Integer(STARTTAG));
entityTypes.put("ENDTAG", new Integer(ENDTAG));
entityTypes.put("MS", new Integer(MS));
entityTypes.put("MD", new Integer(MD));
entityTypes.put("SYSTEM", new Integer(SYSTEM));
Integer i = (Integer)entityTypes.get(nm);
return (i == null) ? CDATA : i.intValue();
|
|