Class ContentHandlerAdaptor.AttributeListAdapter

  • All Implemented Interfaces:
    org.xml.sax.Attributes
    Enclosing class:
    ContentHandlerAdaptor

    final class ContentHandlerAdaptor.AttributeListAdapter
    extends java.lang.Object
    implements org.xml.sax.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.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private org.xml.sax.AttributeList qAtts  
    • Constructor Summary

      Constructors 
      Constructor Description
      AttributeListAdapter()
      Construct a new adapter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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​(org.xml.sax.AttributeList qAtts)
      Set the embedded AttributeList.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • qAtts

        private org.xml.sax.AttributeList qAtts
    • Constructor Detail

      • AttributeListAdapter

        AttributeListAdapter()
        Construct a new adapter.
    • Method Detail

      • setAttributeList

        void setAttributeList​(org.xml.sax.AttributeList qAtts)
        Set the embedded AttributeList.

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

        Parameters:
        The - SAX1 attribute list (with qnames).
      • getLength

        public int getLength()
        Return the length of the attribute list.
        Specified by:
        getLength in interface org.xml.sax.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 org.xml.sax.Attributes
        Parameters:
        The - attribute's index.
        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 org.xml.sax.Attributes
        Parameters:
        The - attribute's index.
        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 org.xml.sax.Attributes
        Parameters:
        The - attribute's index.
        Returns:
        The attribute's qualified name, internalized.
      • getType

        public java.lang.String getType​(int i)
        Return the type of the specified attribute.
        Specified by:
        getType in interface org.xml.sax.Attributes
        Parameters:
        The - attribute's index.
        Returns:
        The attribute's type as an internalized string.
      • getValue

        public java.lang.String getValue​(int i)
        Return the value of the specified attribute.
        Specified by:
        getValue in interface org.xml.sax.Attributes
        Parameters:
        The - attribute's index.
        Returns:
        The attribute's value.
      • 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 org.xml.sax.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 org.xml.sax.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 org.xml.sax.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 org.xml.sax.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 org.xml.sax.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 org.xml.sax.Attributes
        Parameters:
        qName - The qualified name.
        Returns:
        The attribute's value.