Matra DTD Parser 0.8b

com.conradroche.matra.decl
Class Entity

java.lang.Object
  |
  +--com.conradroche.matra.decl.Entity
All Implemented Interfaces:
Entity, ExternalID
Direct Known Subclasses:
GeneralEntity, ParameterEntity

public class Entity
extends Object
implements Entity

Class to hold an entity declaration.

Author:
Conrad Roche

Field Summary
static int EXT_ID_NONE
          Constant to indicate that this attribute has no external id.
static int EXT_ID_PUBLIC
          Constant to indicate that this attribute has a public id.
static int EXT_ID_SYSTEM
          Constant to indicate that this attribute has a system id.
static int GLOBAL_ENTITY
          Constant to indicate that this is a global entity.
static int PARAMETER_ENTITY
          Constant to indicate that this is a parameter entity.
 
Constructor Summary
Entity()
          Entity constructor.
Entity(String content)
          Entity Constructor.
Entity(String content, Hashtable EntityList)
          Entity Constructor.
Entity(String name, String value, int type)
          Entity constructor.
 
Method Summary
 String getEntityName()
          Returns the Entity Name.
 int getExternalIDType()
          Returns the external ID type for this entity.
 String getLiteralValue()
          Returns the literal value of this entity.
 String getPublicIdentifier()
          Returns the public identifier for this entity.
 String getReplacementText()
          Returns the replacement text for this Entity.
 String getResolvedValue(Hashtable EntityList)
          Returns the resolved value for this entity.
 String getSystemIdentifier()
          Returns the system identifier.
 int getType()
          Returns the entity type.
 boolean hasPublicIdentifier()
          Returns true if the Public Identifier is specified.
 boolean hasSystemIdentifier()
          Returns true if the System Identifier is specified.
 boolean isExternalEntity()
          Returns true if this entity is an external entity; false otherwise.
 boolean isGeneralEntity()
          Returns true if the Entity is a General Entity and false otherwise.
 boolean isInternalEntity()
          Returns true if this entity is an internal entity; false otherwise.
 boolean isParameterEntity()
          Returns true if the Entity is a Parameter Entity and false otherwise.
 boolean isParsedEntity()
          Returns true if this entity is an parsed entity; false otherwise.
 boolean isResolved()
          Checks if this entity value is resolved.
 boolean isUnparsedEntity()
          Returns true if this entity is an parsed entity; false otherwise.
 void resolveValue(Hashtable entityList)
          Insert the method's description here.
 void setEntityName(String newName)
          Sets the Entity Name.
 void setLiteralValue(String newValue)
          Sets the literal value of this entity.
 void setPublicIdentifier(String publicId)
          Sets the Public Identifier.
 void setSystemIdentifier(String systemId)
          Sets the System Identifier.
 void setType(int newType)
          Sets the entity type.
 String toString()
          Returns a DTD String representation for this entity.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PARAMETER_ENTITY

public static final int PARAMETER_ENTITY
Constant to indicate that this is a parameter entity.

GLOBAL_ENTITY

public static final int GLOBAL_ENTITY
Constant to indicate that this is a global entity.

EXT_ID_NONE

public static final int EXT_ID_NONE
Constant to indicate that this attribute has no external id.

EXT_ID_SYSTEM

public static final int EXT_ID_SYSTEM
Constant to indicate that this attribute has a system id.

EXT_ID_PUBLIC

public static final int EXT_ID_PUBLIC
Constant to indicate that this attribute has a public id.
Constructor Detail

Entity

public Entity()
Entity constructor.

Entity

public Entity(String name,
              String value,
              int type)
Entity constructor.
Parameters:
name - The name of the entity.
value - The value of the enetity.
type - an int specifying the entity type.

Entity

public Entity(String content)
       throws DTDException
Entity Constructor.
Parameters:
content - The entity declaration.
Throws:
DTDException - If any syntax error is encountered.

Entity

public Entity(String content,
              Hashtable EntityList)
       throws DTDException
Entity Constructor.
Parameters:
content - The entity declaration.
EntityList - a Hashtable object
Throws:
DTDException - If any syntax error is encountered.
Method Detail

getExternalIDType

public int getExternalIDType()
Returns the external ID type for this entity.
Returns:
the external ID type for this entity.
See Also:
#setExternalIDType

getEntityName

public String getEntityName()
Returns the Entity Name.
Specified by:
getEntityName in interface Entity
Returns:
The Entity Name.
See Also:
setEntityName(java.lang.String)

getPublicIdentifier

public String getPublicIdentifier()
Returns the public identifier for this entity.
Specified by:
getPublicIdentifier in interface ExternalID
Returns:
The public identifier for this entity.
See Also:
setPublicIdentifier(java.lang.String)

setPublicIdentifier

public void setPublicIdentifier(String publicId)
Sets the Public Identifier.
Specified by:
setPublicIdentifier in interface ExternalID
Parameters:
publicId - The Public Identifier
See Also:
getPublicIdentifier()

getResolvedValue

public String getResolvedValue(Hashtable EntityList)
Returns the resolved value for this entity.
Parameters:
EntityList - All the declared entities in this DTD.
Returns:
The resolved value.

getSystemIdentifier

public String getSystemIdentifier()
Returns the system identifier.
Specified by:
getSystemIdentifier in interface ExternalID
Returns:
The system identifier.
See Also:
setSystemIdentifier(java.lang.String)

setSystemIdentifier

public void setSystemIdentifier(String systemId)
Sets the System Identifier.
Specified by:
setSystemIdentifier in interface ExternalID
Parameters:
systemId - The System Identifier
See Also:
getSystemIdentifier()

getType

public int getType()
Returns the entity type.
Returns:
The entity type.
See Also:
setType(int)

getLiteralValue

public String getLiteralValue()
Returns the literal value of this entity.
Specified by:
getLiteralValue in interface Entity
Returns:
The literal value
See Also:
setLiteralValue(java.lang.String)

getReplacementText

public String getReplacementText()
Returns the replacement text for this Entity. From the XML 1.0 Specification - [Definition: The replacement text is the content of the entity, after replacement of character references and parameter-entity references.]
Specified by:
getReplacementText in interface Entity
Returns:
The replacement text.

isInternalEntity

public boolean isInternalEntity()
Returns true if this entity is an internal entity; false otherwise. From the XML 1.0 Specifications - [Definition: If the entity definition is an EntityValue, the defined entity is called an internal entity. There is no separate physical storage object, and the content of the entity is given in the declaration.] Note that some processing of entity and character references in the literal entity literalValue may be required to produce the correct replacement text
Specified by:
isInternalEntity in interface Entity
Returns:
true if this entity is an internal entity; false otherwise.

isExternalEntity

public boolean isExternalEntity()
Returns true if this entity is an external entity; false otherwise. Add javadoc for Entity::isExternalEntity From the XML 1.0 Specifications - Definition: If the entity is not internal, it is an external entity
Specified by:
isExternalEntity in interface Entity
Returns:
true if this entity is an external entity; false otherwise.

isParsedEntity

public boolean isParsedEntity()
Returns true if this entity is an parsed entity; false otherwise. From XML 1.0 Specifications - [Definition: A parsed entity's contents are referred to as its replacement text; this text is considered an integral part of the document.]
Specified by:
isParsedEntity in interface Entity
Returns:
true if this entity is an parsed entity; false otherwise.

isUnparsedEntity

public boolean isUnparsedEntity()
Returns true if this entity is an parsed entity; false otherwise. From XML 1.0 Specifications - [Definition: An unparsed entity is a resource whose contents may or may not be text, and if text, may be other than XML. Each unparsed entity has an associated notation, identified by name. Beyond a requirement that an XML processor make the identifiers for the entity and notation available to the application, XML places no constraints on the contents of unparsed entities.]
Specified by:
isUnparsedEntity in interface Entity
Returns:
true if this entity is an parsed entity; false otherwise.

isResolved

public boolean isResolved()
Checks if this entity value is resolved.
Returns:
true if the entity is resolved; false otherwise.

resolveValue

public void resolveValue(Hashtable entityList)
                  throws DTDException
Insert the method's description here.
Parameters:
entityList -  
Throws:
DTDException -  

setEntityName

public void setEntityName(String newName)
Sets the Entity Name.
Specified by:
setEntityName in interface Entity
Parameters:
newName - the Entity Name.
See Also:
getEntityName()

setType

public void setType(int newType)
Sets the entity type.
Parameters:
newType - the entity type.
See Also:
getType()

setLiteralValue

public void setLiteralValue(String newValue)
Sets the literal value of this entity.
Specified by:
setLiteralValue in interface Entity
Parameters:
newValue - The literal value of this entity.
See Also:
getLiteralValue()

toString

public String toString()
Returns a DTD String representation for this entity.
Overrides:
toString in class Object
Returns:
The DTD string representation.

isGeneralEntity

public boolean isGeneralEntity()
Returns true if the Entity is a General Entity and false otherwise.
Specified by:
isGeneralEntity in interface Entity
Returns:
true for General Entity and false otherwise.
See Also:
Entity.isGeneralEntity()

isParameterEntity

public boolean isParameterEntity()
Returns true if the Entity is a Parameter Entity and false otherwise.
Specified by:
isParameterEntity in interface Entity
Returns:
true for Parameter Entity and false otherwise.
See Also:
Entity.isParameterEntity()

hasSystemIdentifier

public boolean hasSystemIdentifier()
Returns true if the System Identifier is specified.
Specified by:
hasSystemIdentifier in interface ExternalID
Returns:
true if the System Identifier is specified false otherwise.
See Also:
ExternalID.hasSystemIdentifier()

hasPublicIdentifier

public boolean hasPublicIdentifier()
Returns true if the Public Identifier is specified.
Specified by:
hasPublicIdentifier in interface ExternalID
Returns:
true if the Public Identifier is specified false otherwise.
See Also:
ExternalID.hasPublicIdentifier()

Matra DTD Parser 0.8b