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

# Class com.ibm.xml.parser.TXAttribute

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

public class TXAttribute
extends Child
implements Attribute, Namespace

The TXAttribute class implements the Attribute interface as defined by the Document Object Model (DOM), and implements the namespace interface as defined by the W3C.

Attribute Nodes represent an attribute in an Element object; in other words, an attribute name and an attribute object. Typically the allowable values for the attribute are defined in a document type definition.

The attribute's effective value is determined as follows: if the attribute has been explicitly assigned any value, that value is the attribute's effective value. Otherwise, if there is a declaration for this attribute, and that declaration includes a default value, then that default value is the attribute's effective value. Otherwise, the attribute has no effective value.

In XML, the value of an attribute is represented by a list because the value can be an arbitrarily complex list of entity references.

Version:
  1.1
See Also:
  Attribute, Namespace, Child

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

Constructor Summary
TXAttribute(java.lang.String name, java.lang.String value) Constructor.

Method Summary
java.lang.Object | clone() Clone this TXAttribute Node using the appropriate factory.
boolean | equals(java.lang.Object object) Returns whether the specified object matches this Attribute Node.
java.lang.String | getName() Returns the qualified name of this Attribute.
int | getNodeType() Returns that this object is an Attribute Node.
java.lang.String | getNSLocalName() Returns the local name of the Namespace.
java.lang.String | getNSName() Returns the Namespace URI.
boolean | getSpecified() Returns whether this Attribute was explicitly given a value in the original document (=true), or was allowed to default according to the DTD specification.
java.lang.String | getText() Returns this Node in XML format, in `name="value"` format, and using the default character encoding.
int | getType() Returns the type of the Attribute.
java.lang.String[] | getTypedValue() Returns the type values of the Attribute.
java.lang.String | getUniversalName() If namespace support is enabled and this Attribute's name contains a prefix name, return a string of `getNSName()+":"+getNSLocalName()`; otherwise, return `getNSLocalName()` .
java.lang.String | getValue() Returns the value of this Attribute.
void | setNSLocalName(java.lang.String nsLocalName) Sets the local name of the Namespace.
void | setNSName(java.lang.String nsURI) Sets the Namespace URI.
void | setSpecified(boolean specified) Sets whether this Attribute was explicitly given a value in the original document (=true), or was allowed to default according to the DTD specification.
void | setType(int type, java.lang.String[] typedValue) Sets the type and type values of the Attribute.
void | setValue(java.lang.String value) Sets the value of this Attribute.
java.lang.String | toXMLString() Returns this Node in XML format, in `name="value"` format, and using the default character encoding.
java.lang.String | toXMLString(java.lang.String enc) Returns this Node in XML format, in `name="value"` format, and using the specified character encoding.

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

### TXAttribute

    public TXAttribute(java.lang.String name,
                       java.lang.String value)

  Constructor.
  Parameters:
    `name` - The name of this Attribute.
    `data` - The string value of this Attribute.

Method Detail

### clone

    public java.lang.Object clone()

  Clone this TXAttribute Node using the appropriate factory. Note that this method does not clone Parent or sibling Nodes.

  This method is defined by Child.

  Returns:
    Cloned TXAttribute Node.
  Overrides:
    clone in class Child
  See Also:
    clone

### getNodeType

    public int getNodeType()

  Returns that this object is an Attribute Node.

  This method is defined by DOM.

  Returns:
    Attribute Node indicator.

### getName

    public java.lang.String getName()

  Returns the qualified name of this Attribute. If the attribute name has a namespace prefix, the prefix will still be attached.

  This method is defined by DOM.

  Implements:
    getName in interface Attribute
  Returns:
    The name of this Attribute (should never be null)

### getValue

    public java.lang.String getValue()

  Returns the value of this Attribute.

  This method is defined by DOM.

  Implements:
    getValue in interface Attribute
  Returns:
    The value of this Attribute, or "" if no value.
  See Also:
    getTypedValue, setValue

### setValue

    public void setValue(java.lang.String value)

  Sets the value of this Attribute.
  Parameters:
    `value` - The value of this Attribute.
  See Also:
    getValue, getTypedValue

### getSpecified

    public boolean getSpecified()

  Returns whether this Attribute was explicitly given a value in the original document (=true), or was allowed to default according to the DTD specification.
  Implements:
    getSpecified in interface Attribute
  Returns:
    =true if value explicitly defined; otherwise, false.
  See Also:
    setSpecified

### setSpecified

    public void setSpecified(boolean specified)

  Sets whether this Attribute was explicitly given a value in the original document (=true), or was allowed to default according to the DTD specification.
  Implements:
    setSpecified in interface Attribute
  Parameters:
    `specified` - =true if value explicitly defined; otherwise, false.
  See Also:
    getSpecified

### getNSLocalName

    public java.lang.String getNSLocalName()

  Returns the local name of the Namespace.

  This method is defined by Namespace.

  Implements:
    getNSLocalName in interface Namespace
  Returns:
    The Namespace local name, or null if no local name.
  See Also:
    Namespace, setNSLocalName

### setNSLocalName

    public void setNSLocalName(java.lang.String nsLocalName)

  Sets the local name of the Namespace.

  This method is defined by Namespace.

  Implements:
    setNSLocalName in interface Namespace
  Parameters:
    `nsLocalName` - The Namespace local name.
  See Also:
    Namespace, getNSLocalName

### getNSName

    public java.lang.String getNSName()

  Returns the Namespace URI.

  This method is defined by Namespace.

  Implements:
    getNSName in interface Namespace
  Returns:
    The Namespace URI, or null if the tag name does not contain a prefix name or XML4J parser namespace processing is disabled.
  See Also:
    setNSName, setProcessNamespace, Namespace

### setNSName

    public void setNSName(java.lang.String nsURI)

  Sets the Namespace URI.

  This method is defined by Namespace.

  Implements:
    setNSName in interface Namespace
  Parameters:
    `nsURI` - The Namespace URI, or null if no name.
  See Also:
    getNSName, Namespace

### getUniversalName

    public java.lang.String getUniversalName()

  If namespace support is enabled and this Attribute's name contains a prefix name, return a string of `getNSName()+":"+getNSLocalName()`; otherwise, return `getNSLocalName()` .
  Implements:
    getUniversalName in interface Namespace
  Returns:
    The universal name, or null if this Attribute's name does not contain a prefix name or XML4J parser namespace processing is disabled.
  See Also:
    getNSName, getNSLocalName, setProcessNamespace

### getType

    public int getType()

  Returns the type of the Attribute. Attribute types are only set when a grammar definition (DTD) is available.
  Returns:
    The Attribute type as defined by AttDef.Java, or null when no type.
  See Also:
    AttDef, setType, getTypedValue

### getTypedValue

    public java.lang.String[] getTypedValue()

  Returns the type values of the Attribute. Attribute type values are only set when a grammar definition (DTD) is available.
  Returns:
    `getTypeValue()[0] = getValue()` when `getType() = CDATA, NOTATION, ID, IDREF, ENTITY, NMTOKEN`; otherwise, multiple values are returned.
  See Also:
    AttDef, setType, getType

### setType

    public void setType(int type,
                        java.lang.String[] typedValue)

  Sets the type and type values of the Attribute. Attribute types are only set when a grammar definition (DTD) is available.
  Parameters:
    `type` - The Attribute type as defined by AttDef.Java.
    `typedValue` - `getTypeValue()[0] = getValue()` when `getType() = CDATA, NOTATION, ID, IDREF, ENTITY, NMTOKEN`; otherwise, multiple values are returned.
  See Also:
    AttDef, setType, getType, getTypedValue

### toXMLString

    public java.lang.String toXMLString()

  Returns this Node in XML format, in `name="value"` format, and using the default character encoding. Entities embedded in the returned string will be respected. For example, the characters `<, >, &, ', and "` will be represented as `&lt;, &gt;, &amp;, &apos;, &quot;` .
  Returns:
    XML formatted string expressed as `name="value"`.
  See Also:
    getText, Entity

### toXMLString

    public java.lang.String toXMLString(java.lang.String enc)

  Returns this Node in XML format, in `name="value"` format, and using the specified character encoding. Entities embedded in the returned string will be respected. For example, the characters `<, >, &, ', and "` will be represented as `&lt;, &gt;, &amp;, &apos;, &quot;` .
  Parameters:
    `enc` - Java character encoding to use.
  Returns:
    XML formatted string expressed as `name="value"`.
  See Also:
    getText, Entity

### getText

    public java.lang.String getText()

  Returns this Node in XML format, in `name="value"` format, and using the default character encoding. Entities embedded in the returned string will be respected. For example, the characters `<, >, &, ', and "` will be represented as `&lt;, &gt;, &amp;, &apos;, &quot;` .
  Returns:
    XML formatted string expressed as `name="value"`.
  Overrides:
    getText in class Child
  See Also:
    toXMLString, Entity

### equals

    public boolean equals(java.lang.Object object)

  Returns whether the specified object matches this Attribute Node. A match is defined when the specified object's name matches the name of this Attribute.
  Returns:
    =true if the names match; otherwise, false.
  Overrides:
    equals in class java.lang.Object

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