XML for Java Compatibility API 2.0.11

com.ibm.xml.parser
Class AttDef

java.lang.Object
  |
  +--com.ibm.xml.parser.Child
        |
        +--com.ibm.xml.parser.AttDef
Direct Known Subclasses:
TreeFactory.TreeAttDef

public class AttDef
extends Child

This class provides support for a single attribute object that is declared as part of an Element's attribute list declaration in the DTD. Refer to Attlist for a detailed description.

Version:
Revision: 54 1.5 src/com/ibm/xml/parser/AttDef.java, parser, xml4j2, xml4j2_0_11
See Also:
Attlist, Child, Serialized Form

Field Summary
static int CDATA
           
static int ENTITIES
           
static int ENTITY
           
static int FIXED
           
static int ID
           
static int IDREF
           
static int IDREFS
           
static int IMPLIED
           
static int NAME_TOKEN_GROUP
           
static int NMTOKEN
           
static int NMTOKENS
           
static int NOFIXED
           
static int NOTATION
           
static int REQUIRED
           
static java.lang.String[] S_TYPESTR
           
static int UNKNOWN
           
 
Fields inherited from class com.ibm.xml.parser.Child
ATTDEF, ATTLIST, ELEMENT_DECL, NAME_ATTDEF, NAME_ATTLIST, NAME_CDATA, NAME_COMMENT, NAME_DOCFRAGMENT, NAME_DOCUMENT, NAME_ELEMENT_DECL, NAME_PSEUDONODE, NAME_TEXT, PSEUDONODE
 
Constructor Summary
AttDef(java.lang.String name)
          Constructor.
 
Method Summary
 void acceptPost(Visitor visitor)
          Implements the accept operation of the visitor design pattern when the end of an AttDef Node is recognized when traversing the document object tree.
 void acceptPre(Visitor visitor)
          Implements the accept operation of the visitor design pattern when the start of an AttDef Node is recognized when traversing the document object tree.
 boolean addElement(java.lang.String token)
          Adds the specified token to the end of the list of tokens that can be used as values for this enumerated attribute type; the specified token has no meaning for other attribute types.
 java.lang.Object clone()
          Clone this attribute definition using the appropriate factory.
 boolean contains(java.lang.String token)
          Returns whether the specified token is in the list of tokens that can be used as values for this enumerated attribute type; the returned value has no meaning for other attribute types.
 java.lang.String elementAt(int index)
          Returns the token at the specified index in the list of tokens that can be used as values for this enumerated attribute type; the returned token has no meaning for other attribute types.
 java.util.Enumeration elements()
          Returns a list of all tokens that can be used as values for this enumerated attribute type; the returned value has no meaning for other attribute types.
 boolean equals(org.w3c.dom.Node arg, boolean deep)
           
 int getDeclaredType()
          Returns the declared type of this attribute in the DTD definition.
 java.lang.String getDefaultStringValue()
          Returns the default value of this attribute in the DTD definition.
 int getDefaultType()
          Returns the default type of this attribute's value in the DTD definition.
 java.lang.String getName()
          Returns the name of this attribute in the DTD definition.
 java.lang.String getNodeName()
           
 short getNodeType()
          Returns that this object is an attribute definition Node.
 void setDeclaredType(int declaredValueType)
          Sets the declared type of this attribute in the DTD definition.
 void setDefaultStringValue(java.lang.String value)
          Sets the default value of this attribute in the DTD definition.
 void setDefaultType(int defaultValueType)
          Sets the default type of this attribute's value in the DTD definition.
 void setName(java.lang.String name)
          Sets the name of this attribute in the DTD definition.
 int size()
          Returns the number of tokens in the list of tokens that can be used as values for this enumerated attribute type; the returned value has no meaning for other attribute types.
 
Methods inherited from class com.ibm.xml.parser.Child
appendChild, clearDigest, cloneNode, getAttributes, getChildNodes, getDigest, getFactory, getFirstChild, getFirstWithoutReference, getLastChild, getLastWithoutReference, getNextSibling, getNextWithoutReference, getNodeValue, getOwnerDocument, getParentNode, getParentWithoutReference, getPreviousSibling, getPreviousWithoutReference, getText, getUserData, hasChildNodes, insertBefore, makeXPointer, print, print, removeChild, replaceChild, searchAncestors, searchAncestors, setFactory, setNodeValue, setUserData, toXMLString, toXMLString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CDATA

public static final int CDATA

ID

public static final int ID

IDREF

public static final int IDREF

IDREFS

public static final int IDREFS

ENTITY

public static final int ENTITY

ENTITIES

public static final int ENTITIES

NMTOKEN

public static final int NMTOKEN

NMTOKENS

public static final int NMTOKENS

NOTATION

public static final int NOTATION

NAME_TOKEN_GROUP

public static final int NAME_TOKEN_GROUP

S_TYPESTR

public static final java.lang.String[] S_TYPESTR

FIXED

public static final int FIXED

REQUIRED

public static final int REQUIRED

IMPLIED

public static final int IMPLIED

NOFIXED

public static final int NOFIXED

UNKNOWN

public static final int UNKNOWN
Constructor Detail

AttDef

public AttDef(java.lang.String name)
Constructor.
Parameters:
name - Name of this attribute as defined by the DTD.
Method Detail

clone

public java.lang.Object clone()
Clone this attribute definition using the appropriate factory.

This method is defined by Child.

Returns:
Cloned attribute definition.
Overrides:
clone in class Child
See Also:
Child.clone()

equals

public boolean equals(org.w3c.dom.Node arg,
                      boolean deep)
Parameters:
deep - ignored.
Overrides:
equals in class Child

getNodeType

public short getNodeType()
Returns that this object is an attribute definition Node.

This method is defined by DOM.

Returns:
Attribute definition Node indicator.

getNodeName

public java.lang.String getNodeName()

getName

public java.lang.String getName()
Returns the name of this attribute in the DTD definition.
Returns:
Name of this attribute in the DTD definition.
See Also:
setName(java.lang.String)

setName

public void setName(java.lang.String name)
Sets the name of this attribute in the DTD definition.
Parameters:
name - Name of this attribute in the DTD definition.
See Also:
getName()

getDeclaredType

public int getDeclaredType()
Returns the declared type of this attribute in the DTD definition.
Returns:
Declared type of this attribute in the DTD definition.
See Also:
setDeclaredType(int)

setDeclaredType

public void setDeclaredType(int declaredValueType)
Sets the declared type of this attribute in the DTD definition.
Parameters:
declaredValueType - Declared type of this attribute in the DTD definition.
See Also:
getDeclaredType()

getDefaultStringValue

public java.lang.String getDefaultStringValue()
Returns the default value of this attribute in the DTD definition. This is useful if this attribute was not given an explicit value in the document instance. The returned value is only meaningful for attribute types defined as FIXED or NOFIXED.
Returns:
The default value of the attribute, or null if none specified.
See Also:
setDefaultStringValue(java.lang.String)

setDefaultStringValue

public void setDefaultStringValue(java.lang.String value)
Sets the default value of this attribute in the DTD definition. This is useful if this attribute was not given an explicit value in the document instance. The specified value is only meaningful for attribute types defined as FIXED or NOFIXED.
Parameters:
value - The default value of the attribute in the DTD definition.
See Also:
getDefaultStringValue()

addElement

public boolean addElement(java.lang.String token)
Adds the specified token to the end of the list of tokens that can be used as values for this enumerated attribute type; the specified token has no meaning for other attribute types. Enumerated attribute types are: NOTATION and NAME_TOKEN_GROUP.
Parameters:
token - Value to add to the list of valid tokens for this enumerated attribute.
Returns:
=true if the token does not already exist in this token list; otherwise, =false.
See Also:
elementAt(int), contains(java.lang.String), size(), elements()

elementAt

public java.lang.String elementAt(int index)
Returns the token at the specified index in the list of tokens that can be used as values for this enumerated attribute type; the returned token has no meaning for other attribute types. Enumerated attribute types are: NOTATION and NAME_TOKEN_GROUP.
Parameters:
index - Index into the list of tokens that can be used as values for this enumerated attribute type.
Returns:
Token at the specified index, or null if an invalid index.
See Also:
addElement(java.lang.String), contains(java.lang.String), size(), elements()

contains

public boolean contains(java.lang.String token)
Returns whether the specified token is in the list of tokens that can be used as values for this enumerated attribute type; the returned value has no meaning for other attribute types. Enumerated attribute types are: NOTATION and NAME_TOKEN_GROUP.
Parameters:
token - Value to check in the list of valid tokens for this enumerated attribute.
Returns:
=true if token is defined; otherwise, =false.
See Also:
addElement(java.lang.String), elementAt(int), size(), elements()

size

public int size()
Returns the number of tokens in the list of tokens that can be used as values for this enumerated attribute type; the returned value has no meaning for other attribute types. Enumerated attribute types are: NOTATION and NAME_TOKEN_GROUP.
Returns:
Number of tokens, or null if no tokens defined.
See Also:
addElement(java.lang.String), elementAt(int), contains(java.lang.String), elements()

elements

public java.util.Enumeration elements()
Returns a list of all tokens that can be used as values for this enumerated attribute type; the returned value has no meaning for other attribute types. Enumerated attribute types are: NOTATION and NAME_TOKEN_GROUP.
Returns:
The list of allowed tokens for the attribute value as defined by the DTD definition, or null if none specified.
See Also:
addElement(java.lang.String), elementAt(int), size(), contains(java.lang.String)

getDefaultType

public int getDefaultType()
Returns the default type of this attribute's value in the DTD definition.
Returns:
The default type of this attribute in the DTD definition.
See Also:
setDefaultType(int)

setDefaultType

public void setDefaultType(int defaultValueType)
Sets the default type of this attribute's value in the DTD definition.
Parameters:
defaultValueType - The default type of this attribute in the DTD definition.
See Also:
getDefaultType()

acceptPre

public void acceptPre(Visitor visitor)
               throws java.lang.Exception
Implements the accept operation of the visitor design pattern when the start of an AttDef Node is recognized when traversing the document object tree.
Parameters:
visitor - The implemention of the Visitor operation (toXMLString, digest, ...)
Throws:
java.lang.Exception - Thrown if this Node can not be visitted, or traversal modification is requested.
See Also:
Visitor, TreeTraversal, NonRecursivePreorderTreeTraversal, TreeTraversalException

acceptPost

public void acceptPost(Visitor visitor)
                throws java.lang.Exception
Implements the accept operation of the visitor design pattern when the end of an AttDef Node is recognized when traversing the document object tree.
Parameters:
visitor - The implemention of the Visitor operation (toXMLString, digest, ...)
Throws:
java.lang.Exception - Thrown if this Node can not be visitted, or traversal modification is requested.
See Also:
Visitor, TreeTraversal, NonRecursivePreorderTreeTraversal, TreeTraversalException

XML for Java Compatibility API 2.0.11