org.apache.xerces.parsers

## Class AbstractSAXParser.AttributesProxy

- java.lang.Object
- - org.apache.xerces.parsers.AbstractSAXParser.AttributesProxy

- All Implemented Interfaces:
    org.xml.sax.AttributeList, org.xml.sax.Attributes, org.xml.sax.ext.Attributes2
  Enclosing class:
    AbstractSAXParser

      protected static final class AbstractSAXParser.AttributesProxy
      extends java.lang.Object
      implements org.xml.sax.AttributeList, org.xml.sax.ext.Attributes2

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.apache.xerces.xni.XMLAttributes` | `fAttributes` XML attributes.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractSAXParser.AttributesProxy()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getIndex(java.lang.String qName)` Look up the index of an attribute by XML qualified (prefixed) name.
    `int` | `getIndex(java.lang.String uri, java.lang.String localPart)` Look up the index of an attribute by Namespace name.
    `int` | `getLength()` Return the number of attributes in this list.
    `java.lang.String` | `getLocalName(int index)` Look up an attribute's local name by index.
    `java.lang.String` | `getName(int i)` Return the name of an attribute in this list (by position).
    `java.lang.String` | `getQName(int index)` Look up an attribute's XML qualified (prefixed) name by index.
    `java.lang.String` | `getType(int i)` Return the type of an attribute in the list (by position).
    `java.lang.String` | `getType(java.lang.String name)` Return the type of an attribute in the list (by name).
    `java.lang.String` | `getType(java.lang.String uri, java.lang.String localName)` Look up an attribute's type by Namespace name.
    `java.lang.String` | `getURI(int index)` Look up an attribute's Namespace URI by index.
    `java.lang.String` | `getValue(int i)` Return the value of an attribute in the list (by position).
    `java.lang.String` | `getValue(java.lang.String name)` Return the value of an attribute in the list (by name).
    `java.lang.String` | `getValue(java.lang.String uri, java.lang.String localName)` Look up an attribute's value by Namespace name.
    `boolean` | `isDeclared(int index)` Returns false unless the attribute was declared in the DTD.
    `boolean` | `isDeclared(java.lang.String qName)` Returns false unless the attribute was declared in the DTD.
    `boolean` | `isDeclared(java.lang.String uri, java.lang.String localName)` Returns false unless the attribute was declared in the DTD.
    `boolean` | `isSpecified(int index)` Returns true unless the attribute value was provided by DTD defaulting.
    `boolean` | `isSpecified(java.lang.String qName)` Returns true unless the attribute value was provided by DTD defaulting.
    `boolean` | `isSpecified(java.lang.String uri, java.lang.String localName)` Returns true unless the attribute value was provided by DTD defaulting.
    `void` | `setAttributes(org.apache.xerces.xni.XMLAttributes attributes)` Sets the XML attributes.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### fAttributes

          protected org.apache.xerces.xni.XMLAttributes fAttributes

      XML attributes.

  - ### Constructor Detail

    - #### AbstractSAXParser.AttributesProxy

          protected AbstractSAXParser.AttributesProxy()

  - ### Method Detail

    - #### setAttributes

          public void setAttributes(org.apache.xerces.xni.XMLAttributes attributes)

      Sets the XML attributes.

    - #### getLength

          public int getLength()

      Description copied from interface: `org.xml.sax.AttributeList`
      Return the number of attributes in this list.

      The SAX parser may provide attributes in any arbitrary order, regardless of the order in which they were declared or specified. The number of attributes may be zero.

      Specified by:
        `getLength` in interface `org.xml.sax.AttributeList`
      Specified by:
        `getLength` in interface `org.xml.sax.Attributes`
      Returns:
        The number of attributes in the list.
      See Also:
        `Attributes.getURI(int)`, `Attributes.getLocalName(int)`, `Attributes.getQName(int)`, `Attributes.getType(int)`, `Attributes.getValue(int)`

    - #### getName

          public java.lang.String getName(int i)

      Description copied from interface: `org.xml.sax.AttributeList`
      Return the name of an attribute in this list (by position).

      The names must be unique: the SAX parser shall not include the same attribute twice. Attributes without values (those declared #IMPLIED without a value specified in the start tag) will be omitted from the list.

      If the attribute name has a namespace prefix, the prefix will still be attached.

      Specified by:
        `getName` in interface `org.xml.sax.AttributeList`
      Parameters:
        `i` - The index of the attribute in the list (starting at 0).
      Returns:
        The name of the indexed attribute, or null if the index is out of range.
      See Also:
        `AttributeList.getLength()`

    - #### getQName

          public java.lang.String getQName(int index)

      Description copied from interface: `org.xml.sax.Attributes`
      Look up an attribute's XML qualified (prefixed) name by index.
      Specified by:
        `getQName` in interface `org.xml.sax.Attributes`
      Parameters:
        `index` - The attribute index (zero-based).
      Returns:
        The XML qualified name, or the empty string if none is available, or null if the index is out of range.
      See Also:
        `Attributes.getLength()`

    - #### getURI

          public java.lang.String getURI(int index)

      Description copied from interface: `org.xml.sax.Attributes`
      Look up an attribute's Namespace URI by index.
      Specified by:
        `getURI` in interface `org.xml.sax.Attributes`
      Parameters:
        `index` - The attribute index (zero-based).
      Returns:
        The Namespace URI, or the empty string if none is available, or null if the index is out of range.
      See Also:
        `Attributes.getLength()`

    - #### getLocalName

          public java.lang.String getLocalName(int index)

      Description copied from interface: `org.xml.sax.Attributes`
      Look up an attribute's local name by index.
      Specified by:
        `getLocalName` in interface `org.xml.sax.Attributes`
      Parameters:
        `index` - The attribute index (zero-based).
      Returns:
        The local name, or the empty string if Namespace processing is not being performed, or null if the index is out of range.
      See Also:
        `Attributes.getLength()`

    - #### getType

          public java.lang.String getType(int i)

      Description copied from interface: `org.xml.sax.AttributeList`
      Return the type of an attribute in the list (by position).

      The attribute type is one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION" (always in upper case).

      If the parser has not read a declaration for the attribute, or if the parser does not report attribute types, then it must return the value "CDATA" as stated in the XML 1.0 Recommentation (clause 3.3.3, "Attribute-Value Normalization").

      For an enumerated attribute that is not a notation, the parser will report the type as "NMTOKEN".

      Specified by:
        `getType` in interface `org.xml.sax.AttributeList`
      Specified by:
        `getType` in interface `org.xml.sax.Attributes`
      Parameters:
        `i` - The index of the attribute in the list (starting at 0).
      Returns:
        The attribute type as a string, or null if the index is out of range.
      See Also:
        `AttributeList.getLength()`, `AttributeList.getType(java.lang.String)`

    - #### getType

          public java.lang.String getType(java.lang.String name)

      Description copied from interface: `org.xml.sax.AttributeList`
      Return the type of an attribute in the list (by name).

      The return value is the same as the return value for getType(int).

      If the attribute name has a namespace prefix in the document, the application must include the prefix here.

      Specified by:
        `getType` in interface `org.xml.sax.AttributeList`
      Specified by:
        `getType` in interface `org.xml.sax.Attributes`
      Parameters:
        `name` - The name of the attribute.
      Returns:
        The attribute type as a string, or null if no such attribute exists.
      See Also:
        `AttributeList.getType(int)`

    - #### getType

          public java.lang.String getType(java.lang.String uri,
                                 java.lang.String localName)

      Description copied from interface: `org.xml.sax.Attributes`
      Look up an attribute's type by Namespace name.

      See `getType(int)` for a description of the possible types.

      Specified by:
        `getType` in interface `org.xml.sax.Attributes`
      Parameters:
        `uri` - The Namespace URI, or the empty String if the name has no Namespace URI.
        `localName` - The local name of the attribute.
      Returns:
        The attribute type as a string, or null if the attribute is not in the list or if Namespace processing is not being performed.

    - #### getValue

          public java.lang.String getValue(int i)

      Description copied from interface: `org.xml.sax.AttributeList`
      Return the value of an attribute in the list (by position).

      If the attribute value is a list of tokens (IDREFS, ENTITIES, or NMTOKENS), the tokens will be concatenated into a single string separated by whitespace.

      Specified by:
        `getValue` in interface `org.xml.sax.AttributeList`
      Specified by:
        `getValue` in interface `org.xml.sax.Attributes`
      Parameters:
        `i` - The index of the attribute in the list (starting at 0).
      Returns:
        The attribute value as a string, or null if the index is out of range.
      See Also:
        `AttributeList.getLength()`, `AttributeList.getValue(java.lang.String)`

    - #### getValue

          public java.lang.String getValue(java.lang.String name)

      Description copied from interface: `org.xml.sax.AttributeList`
      Return the value of an attribute in the list (by name).

      The return value is the same as the return value for getValue(int).

      If the attribute name has a namespace prefix in the document, the application must include the prefix here.

      Specified by:
        `getValue` in interface `org.xml.sax.AttributeList`
      Specified by:
        `getValue` in interface `org.xml.sax.Attributes`
      Parameters:
        `name` - the name of the attribute to return
      Returns:
        The attribute value as a string, or null if no such attribute exists.
      See Also:
        `AttributeList.getValue(int)`

    - #### getValue

          public java.lang.String getValue(java.lang.String uri,
                                  java.lang.String localName)

      Description copied from interface: `org.xml.sax.Attributes`
      Look up an attribute's value by Namespace name.

      See `getValue(int)` for a description of the possible values.

      Specified by:
        `getValue` in interface `org.xml.sax.Attributes`
      Parameters:
        `uri` - The Namespace URI, or the empty String if the name has no Namespace URI.
        `localName` - The local name of the attribute.
      Returns:
        The attribute value as a string, or null if the attribute is not in the list.

    - #### getIndex

          public int getIndex(java.lang.String qName)

      Description copied from interface: `org.xml.sax.Attributes`
      Look up the index of an attribute by XML qualified (prefixed) name.
      Specified by:
        `getIndex` in interface `org.xml.sax.Attributes`
      Parameters:
        `qName` - The qualified (prefixed) name.
      Returns:
        The index of the attribute, or -1 if it does not appear in the list.

    - #### getIndex

          public int getIndex(java.lang.String uri,
                     java.lang.String localPart)

      Description copied from interface: `org.xml.sax.Attributes`
      Look up the index of an attribute by Namespace name.
      Specified by:
        `getIndex` in interface `org.xml.sax.Attributes`
      Parameters:
        `uri` - The Namespace URI, or the empty string if the name has no Namespace URI.
        `localPart` - The attribute's local name.
      Returns:
        The index of the attribute, or -1 if it does not appear in the list.

    - #### isDeclared

          public boolean isDeclared(int index)

      Description copied from interface: `org.xml.sax.ext.Attributes2`
      Returns false unless the attribute was declared in the DTD. This helps distinguish two kinds of attributes that SAX reports as CDATA: ones that were declared (and hence are usually valid), and those that were not (and which are never valid).
      Specified by:
        `isDeclared` in interface `org.xml.sax.ext.Attributes2`
      Parameters:
        `index` - The attribute index (zero-based).
      Returns:
        true if the attribute was declared in the DTD, false otherwise.

    - #### isDeclared

          public boolean isDeclared(java.lang.String qName)

      Description copied from interface: `org.xml.sax.ext.Attributes2`
      Returns false unless the attribute was declared in the DTD. This helps distinguish two kinds of attributes that SAX reports as CDATA: ones that were declared (and hence are usually valid), and those that were not (and which are never valid).
      Specified by:
        `isDeclared` in interface `org.xml.sax.ext.Attributes2`
      Parameters:
        `qName` - The XML qualified (prefixed) name.
      Returns:
        true if the attribute was declared in the DTD, false otherwise.

    - #### isDeclared

          public boolean isDeclared(java.lang.String uri,
                           java.lang.String localName)

      Description copied from interface: `org.xml.sax.ext.Attributes2`
      Returns false unless the attribute was declared in the DTD. This helps distinguish two kinds of attributes that SAX reports as CDATA: ones that were declared (and hence are usually valid), and those that were not (and which are never valid).

      Remember that since DTDs do not "understand" namespaces, the namespace URI associated with an attribute may not have come from the DTD. The declaration will have applied to the attribute's qName.

      Specified by:
        `isDeclared` in interface `org.xml.sax.ext.Attributes2`
      Parameters:
        `uri` - The Namespace URI, or the empty string if the name has no Namespace URI.
        `localName` - The attribute's local name.
      Returns:
        true if the attribute was declared in the DTD, false otherwise.

    - #### isSpecified

          public boolean isSpecified(int index)

      Description copied from interface: `org.xml.sax.ext.Attributes2`
      Returns true unless the attribute value was provided by DTD defaulting.
      Specified by:
        `isSpecified` in interface `org.xml.sax.ext.Attributes2`
      Parameters:
        `index` - The attribute index (zero-based).
      Returns:
        true if the value was found in the XML text, false if the value was provided by DTD defaulting.

    - #### isSpecified

          public boolean isSpecified(java.lang.String qName)

      Description copied from interface: `org.xml.sax.ext.Attributes2`
      Returns true unless the attribute value was provided by DTD defaulting.
      Specified by:
        `isSpecified` in interface `org.xml.sax.ext.Attributes2`
      Parameters:
        `qName` - The XML qualified (prefixed) name.
      Returns:
        true if the value was found in the XML text, false if the value was provided by DTD defaulting.

    - #### isSpecified

          public boolean isSpecified(java.lang.String uri,
                            java.lang.String localName)

      Description copied from interface: `org.xml.sax.ext.Attributes2`
      Returns true unless the attribute value was provided by DTD defaulting.

      Remember that since DTDs do not "understand" namespaces, the namespace URI associated with an attribute may not have come from the DTD. The declaration will have applied to the attribute's qName.

      Specified by:
        `isSpecified` in interface `org.xml.sax.ext.Attributes2`
      Parameters:
        `uri` - The Namespace URI, or the empty string if the name has no Namespace URI.
        `localName` - The attribute's local name.
      Returns:
        true if the value was found in the XML text, false if the value was provided by DTD defaulting.

Copyright © 1999-2022 The Apache Software Foundation. All Rights Reserved.