org.xml.sax.helpers
Class ParserAdapter.AttributeListAdapter

java.lang.Object
  |
  +--org.xml.sax.helpers.ParserAdapter.AttributeListAdapter
All Implemented Interfaces:
Attributes
Enclosing class:
ParserAdapter

final class ParserAdapter.AttributeListAdapter
extends java.lang.Object
implements Attributes

Adapt a SAX1 AttributeList as a SAX2 Attributes object.

This class is in the Public Domain, and comes with NO WARRANTY of any kind.

This wrapper class is used only when Namespace support is disabled -- it provides pretty much a direct mapping from SAX1 to SAX2, except that names and types are interned whenever requested.


Constructor Summary
(package private) ParserAdapter.AttributeListAdapter()
          Construct a new adapter.
 
Method Summary
 int getIndex(java.lang.String qName)
          Look up an attribute index by qualified (prefixed) name.
 int getIndex(java.lang.String uri, java.lang.String localName)
          Look up an attribute index by Namespace name.
 int getLength()
          Return the length of the attribute list.
 java.lang.String getLocalName(int i)
          Return the local name of the specified attribute.
 java.lang.String getQName(int i)
          Return the qualified (prefixed) name of the specified attribute.
 java.lang.String getType(int i)
          Return the type of the specified attribute.
 java.lang.String getType(java.lang.String qName)
          Look up the type of an attribute by qualified (prefixed) name.
 java.lang.String getType(java.lang.String uri, java.lang.String localName)
          Look up the type of an attribute by Namespace name.
 java.lang.String getURI(int i)
          Return the Namespace URI of the specified attribute.
 java.lang.String getValue(int i)
          Return the value of the specified attribute.
 java.lang.String getValue(java.lang.String qName)
          Look up the value of an attribute by qualified (prefixed) name.
 java.lang.String getValue(java.lang.String uri, java.lang.String localName)
          Look up the value of an attribute by Namespace name.
(package private)  void setAttributeList(AttributeList qAtts)
          Set the embedded AttributeList.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParserAdapter.AttributeListAdapter

ParserAdapter.AttributeListAdapter()
Construct a new adapter.

Method Detail

setAttributeList

void setAttributeList(AttributeList qAtts)
Set the embedded AttributeList.

This method must be invoked before any of the others can be used.


getLength

public int getLength()
Return the length of the attribute list.

Specified by:
getLength in interface Attributes
Returns:
The number of attributes in the list.
See Also:
Attributes.getLength()

getURI

public java.lang.String getURI(int i)
Return the Namespace URI of the specified attribute.

Specified by:
getURI in interface Attributes
Parameters:
i - The attribute index (zero-based).
Returns:
Always the empty string.
See Also:
Attributes.getURI(int)

getLocalName

public java.lang.String getLocalName(int i)
Return the local name of the specified attribute.

Specified by:
getLocalName in interface Attributes
Parameters:
i - The attribute index (zero-based).
Returns:
Always the empty string.
See Also:
Attributes.getLocalName(int)

getQName

public java.lang.String getQName(int i)
Return the qualified (prefixed) name of the specified attribute.

Specified by:
getQName in interface Attributes
Parameters:
i - The attribute index (zero-based).
Returns:
The attribute's qualified name, internalized.
See Also:
Attributes.getLength()

getType

public java.lang.String getType(int i)
Return the type of the specified attribute.

Specified by:
getType in interface Attributes
Parameters:
i - The attribute index (zero-based).
Returns:
The attribute's type as an internalized string.
See Also:
Attributes.getLength()

getValue

public java.lang.String getValue(int i)
Return the value of the specified attribute.

Specified by:
getValue in interface Attributes
Parameters:
i - The attribute index (zero-based).
Returns:
The attribute's value.
See Also:
Attributes.getLength()

getIndex

public int getIndex(java.lang.String uri,
                    java.lang.String localName)
Look up an attribute index by Namespace name.

Specified by:
getIndex in interface Attributes
Parameters:
uri - The Namespace URI or the empty string.
localName - The local name.
Returns:
The attributes index, or -1 if none was found.
See Also:
Attributes.getIndex(java.lang.String,java.lang.String)

getIndex

public int getIndex(java.lang.String qName)
Look up an attribute index by qualified (prefixed) name.

Specified by:
getIndex in interface Attributes
Parameters:
qName - The qualified name.
Returns:
The attributes index, or -1 if none was found.
See Also:
Attributes.getIndex(java.lang.String)

getType

public java.lang.String getType(java.lang.String uri,
                                java.lang.String localName)
Look up the type of an attribute by Namespace name.

Specified by:
getType in interface Attributes
Parameters:
uri - The Namespace URI
localName - The local name.
Returns:
The attribute's type as an internalized string.

getType

public java.lang.String getType(java.lang.String qName)
Look up the type of an attribute by qualified (prefixed) name.

Specified by:
getType in interface Attributes
Parameters:
qName - The qualified name.
Returns:
The attribute's type as an internalized string.

getValue

public java.lang.String getValue(java.lang.String uri,
                                 java.lang.String localName)
Look up the value of an attribute by Namespace name.

Specified by:
getValue in interface Attributes
Parameters:
uri - The Namespace URI
localName - The local name.
Returns:
The attribute's value.

getValue

public java.lang.String getValue(java.lang.String qName)
Look up the value of an attribute by qualified (prefixed) name.

Specified by:
getValue in interface Attributes
Parameters:
qName - The qualified name.
Returns:
The attribute's value.


Copyright © 1999 The Apache Software Foundation. All Rights reserved.