Matra DTD Parser 0.8b

com.conradroche.matra.decl
Class Attribute

java.lang.Object
  |
  +--com.conradroche.matra.decl.Attribute

public class Attribute
extends Object

Class to hold an Attribute declaration.

Author:
Conrad Roche

Field Summary
static String CDATA
          Constant string denoting the token "CDATA".
static String NOTATION
          Constant string denoting the token "NOTATION".
static String OPTIONALITY_STR_FIXED
          Constant indicating that the attribute is a fixed-value attribute.
static String OPTIONALITY_STR_IMPLIED
          Constant indicating that the attribute is an optional attribute.
static String OPTIONALITY_STR_REQUIRED
          Constant indicating that the attribute is a mandatory attribute.
static int TYPE_ENUMERATION
          Value of getAttType() if the Attribute defined is an Enumeration.
static int TYPE_NOTATION
          Value of getAttType() if the Attribute defined is of Notation Type.
 
Constructor Summary
Attribute()
          Attribute constructor.
Attribute(String elementName, String attrName, int attributeType, String dataType, String defaultDecl)
          Attribute constructor.
Attribute(String elementName, String attrName, String[] enums, String defaultDecl)
          Attribute Constructor for attributes of type Enumeration.
 
Method Summary
 String getAttributeName()
          Get the name of the attribute.
 int getAttType()
          Return the type of the Attribute.
 String getDataType()
          Get the data type of the Attribute.
 String getDefaultValue()
          Get the Default declaration of the Attribute.
 String[] getEnumeratedValues()
          If the Attribute is of Enumerated type, get the list of permitted values.
 String getFixedValue()
          Returns the fixed value for the attribute.
 int getOptionality()
          Get the optionality of the attribute.
 String getOptionalityString()
          Get the optionality of the attribute.
 boolean isEnumeration()
          Checks if the attribute is of type enumeration.
 boolean isIDType()
          Returns true if this attribute is of type ID.
 boolean isNotationType()
          Check if the Attribute is of NOTATION type.
 boolean isStringType()
          Check if the Attribute is of STRING type (i.e.
 void readNextAttribute(DTDData AttDef)
          Read the attribute details from the given data.
 void setAttributeName(String newName)
          Set the name of the attribute.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_NOTATION

public static final int TYPE_NOTATION
Value of getAttType() if the Attribute defined is of Notation Type.

TYPE_ENUMERATION

public static final int TYPE_ENUMERATION
Value of getAttType() if the Attribute defined is an Enumeration.

OPTIONALITY_STR_REQUIRED

public static final String OPTIONALITY_STR_REQUIRED
Constant indicating that the attribute is a mandatory attribute.

OPTIONALITY_STR_IMPLIED

public static final String OPTIONALITY_STR_IMPLIED
Constant indicating that the attribute is an optional attribute.

OPTIONALITY_STR_FIXED

public static final String OPTIONALITY_STR_FIXED
Constant indicating that the attribute is a fixed-value attribute.

NOTATION

public static final String NOTATION
Constant string denoting the token "NOTATION".

CDATA

public static final String CDATA
Constant string denoting the token "CDATA".
Constructor Detail

Attribute

public Attribute()
Attribute constructor.

Attribute

public Attribute(String elementName,
                 String attrName,
                 String[] enums,
                 String defaultDecl)
Attribute Constructor for attributes of type Enumeration.
Parameters:
elementName - The Element name.
attrName - The name of the attribute.
enums - The enumeration for the attribute.
defaultDecl - The default declaration for the attribute.

Attribute

public Attribute(String elementName,
                 String attrName,
                 int attributeType,
                 String dataType,
                 String defaultDecl)
Attribute constructor.
Parameters:
elementName - The Element name.
attrName - The name of the attribute.
attributeType - The type of the attribute.
dataType - The data type of the attribute.
defaultDecl - The default declaration for the attribute.
Method Detail

getAttType

public int getAttType()
Return the type of the Attribute.
Returns:
The attribute type.

getDataType

public String getDataType()
Get the data type of the Attribute.
Returns:
The attribute datatype.
See Also:
#setDataType

getDefaultValue

public String getDefaultValue()
Get the Default declaration of the Attribute.
Returns:
The attribute default declaration.
See Also:
#setDefaultValue

getFixedValue

public String getFixedValue()
Returns the fixed value for the attribute. Returns null if the attribute does not have a fixed values.
Returns:
The fixed value for the attribute.

getEnumeratedValues

public String[] getEnumeratedValues()
If the Attribute is of Enumerated type, get the list of permitted values.
Returns:
The list of permintted values.

getAttributeName

public String getAttributeName()
Get the name of the attribute.
Returns:
The attribute name.
See Also:
setAttributeName(java.lang.String)

getOptionality

public int getOptionality()
Get the optionality of the attribute.
Returns:
The attribute optionality.
See Also:
#setOptionality

getOptionalityString

public String getOptionalityString()
Get the optionality of the attribute.
Returns:
The attribute optionality.

isNotationType

public boolean isNotationType()
Check if the Attribute is of NOTATION type.
Returns:
true if the attribute is a Notation type. false if the attribute is not.

isStringType

public boolean isStringType()
Check if the Attribute is of STRING type (i.e. CDATA).
Returns:
true if the attribute is string type; false otherwise.

isEnumeration

public boolean isEnumeration()
Checks if the attribute is of type enumeration.
Returns:
true the attribute is of type enumeration; false otherwise.

readNextAttribute

public void readNextAttribute(DTDData AttDef)
                       throws DTDSyntaxException
Read the attribute details from the given data.
Parameters:
AttDef - The attribute definition to parse.
Throws:
DTDSyntaxException - If it encounters a syntax exception.

isIDType

public boolean isIDType()
Returns true if this attribute is of type ID.
Returns:
true if the attribute is of type ID; false otherwise.

setAttributeName

public void setAttributeName(String newName)
Set the name of the attribute.
Parameters:
newName - java.lang.String
See Also:
getAttributeName()

Matra DTD Parser 0.8b