Contents | Package | Class | Tree | Deprecated | Index | Help | XML for Java
PREV | NEXT | SHOW LISTS | HIDE LISTS |

# Class com.ibm.xml.parser.Attlist

    java.lang.Object
        |
        +----com.ibm.xml.parser.Child
                |
                +----com.ibm.xml.parser.Attlist

Subclasses:
  TreeFactory.TreeAttlist

public class Attlist
extends Child

The Attlist class provides services in support of DTD attribute list declarations.

We will use the following example to illustrate the capabilities of attribute lists within a PERSON Element:

     <!ATTLIST PERSON
       EMPLOYEETYPE CDATA "PERMANENT"
       LASTNAME CDATA #REQUIRED
       PHONE ENTITY #IMPLIED
       COMPANY CDATA #FIXED "IBM" >

In this example, the attributes `EMPLOYEETYPE` and `COMPANY` have been assigned default values; `EMPLOYEETYPE`'s default value may be changed, but `COMPANY`'s value is fixed and may not be changed.

The `LASTNAME` attribute must be specified with each `PERSON` Element because this attribute is defined as `REQUIRED`.

Just because an attribute is not defined by the attribute list definition, it does not mean that the attribute can not be defined in the document. These attributes are known as `IMPLIED` attributes. However, you will need to explicitly define `IMPLIED` attributes if you want them to have a value type other than `CDATA`.

Value types are defined as follows:

CDATA
  A string-type attribute that can take any literal string as its value.
ID
  An unique identifier for an Element within a given XML document.
IDREF
  A pointer to an Element's ID within a given XML document.
IDREFS
  Same as `IDREF` except multiple pointers may be provided.
ENTITY
  A pointer to an external binary general entity (see Entity for details) defined in this DTD.
ENTITIES
  Same as `ENTITY` except multiple pointers may be provided.
NMTOKEN
  Also known as a name token. This is any mixture of name characters.
NMTOKENS
  Same as `NMTOKEN` except multiple names may be provided.
NOTATION
  A set of notations (see TXNotation for details) that are declared in this DTD.
NAME_TOKEN_GROUP
  A set of `NMTOKEN` tokens.

Version:
  1.1
See Also:
  AttDef, Child, Entity, ExternalID, TXNotation

Fields inherited from class com.ibm.xml.parser.Child
ATTDEF, ATTLIST, DOCUMENTTYPE, ELEMENTDEFINITION, ENTITY, GENERALREFERENCE, NOTATION, PSEUDONODE

Constructor Summary
Attlist(java.lang.String name) Constructor.

Method Summary
boolean | addElement(AttDef attDef) Adds the specified attribute definition to the end of this attribute list .
java.lang.Object | clone() Clone this attribute list Node and its children (AttDefs) using the appropriate factory.
boolean | contains(java.lang.String attDefName) Returns whether the specified attribute definition name is currently defined in this attribute list.
AttDef | elementAt(int index) Returns the attribute definition at the specified index in this attribute list
java.util.Enumeration | elements() Returns an enumeration of all attribute definitions in this attribute list.
AttDef | getAttDef(java.lang.String attDefName) Returns the attribute definition that matches the specified attribute definition name in this attribute list.
java.lang.String | getName() Returns this attribute list's name; this value is also known as the Element type.
int | getNodeType() Returns that this object is an attribute list Node.
int | size() Returns the number of attribute definitions in this attribute list.

Methods inherited from class com.ibm.xml.parser.Child
clearDigest, clone, getChildNodes, getDigest, getFactory, getFirstChild, getNextSibling, getParentNode, getPreviousSibling, getText, hasChildNodes, insertBefore, makeXPointer, print, print, removeChild, replaceChild, searchAncestors, searchAncestors, setFactory, toString, toString

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

### Attlist

    public Attlist(java.lang.String name)

  Constructor.
  Parameters:
    `name` - This attribute list's name; this value is also known as the Element type.

Method Detail

### clone

    public java.lang.Object clone()

  Clone this attribute list Node and its children (AttDefs) using the appropriate factory.
  Returns:
    Cloned attribute list Node.
  Overrides:
    clone in class Child

### getNodeType

    public int getNodeType()

  Returns that this object is an attribute list Node.

  This method is defined by DOM.

  Returns:
    Element Node indicator.

### getName

    public java.lang.String getName()

  Returns this attribute list's name; this value is also known as the Element type.
  Returns:
    The string that is this attribute list's name, or null if no name.

### addElement

    public boolean addElement(AttDef attDef)

  Adds the specified attribute definition to the end of this attribute list .
  Parameters:
    `attDef` - Attribute definition to add to this atribute list.
  Returns:
    =true if the attribute definition does not already exist in this attribute list; otherwise, =false.
  See Also:
    elementAt, getAttDef, contains, size

### elementAt

    public AttDef elementAt(int index)

  Returns the attribute definition at the specified index in this attribute list
  Parameters:
    `index` - Index into this list of attribute definitions.
  Returns:
    Attribute definition at the specified index, or null if an invalid index.
  See Also:
    addElement, getAttDef, contains, size

### getAttDef

    public AttDef getAttDef(java.lang.String attDefName)

  Returns the attribute definition that matches the specified attribute definition name in this attribute list.
  Parameters:
    `attDefName` - Attribute definition name to match in this attribute list.
  Returns:
    The matching attribute definition, or null if the attribute is not currently defined.
  See Also:
    addElement, elementAt, contains, size, elements

### contains

    public boolean contains(java.lang.String attDefName)

  Returns whether the specified attribute definition name is currently defined in this attribute list.
  Parameters:
    `attDefName` - Attribute definition name to match in this attribute list.
  Returns:
    =true if attDefName is defined; otherwise, =false.
  See Also:
    addElement, elementAt, getAttDef, size, elements

### size

    public int size()

  Returns the number of attribute definitions in this attribute list.
  Returns:
    Number of attribute list definitions, or null if no definitions defined.
  See Also:
    addElement, elementAt, getAttDef, contains

### elements

    public java.util.Enumeration elements()

  Returns an enumeration of all attribute definitions in this attribute list.
  Returns:
    An enumeration of all attribute definitions, or null if none specified.
  See Also:
    addElement, elementAt, getAttDef, contains, size

Contents | Package | Class | Tree | Deprecated | Index | Help |
PREV | NEXT | SHOW LISTS | HIDE LISTS |