Class NullAttributes

  • All Implemented Interfaces:
    org.xml.sax.Attributes

    public class NullAttributes
    extends java.lang.Object
    implements org.xml.sax.Attributes
    Null implementation of the Attributes interface.
    Author:
    David Megginson, Sam Ruby
    • Constructor Summary

      Constructors 
      Constructor Description
      NullAttributes()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getIndex​(java.lang.String qName)
      Look up an attribute's index by qualified (prefixed) name.
      int getIndex​(java.lang.String uri, java.lang.String localName)
      Look up an attribute's index by Namespace name.
      int getLength()
      Return the number of attributes in the list.
      java.lang.String getLocalName​(int index)
      Return an attribute's local name.
      java.lang.String getQName​(int index)
      Return an attribute's qualified (prefixed) name.
      java.lang.String getType​(int index)
      Return an attribute's type by index.
      java.lang.String getType​(java.lang.String qName)
      Look up an attribute's type by qualified (prefixed) name.
      java.lang.String getType​(java.lang.String uri, java.lang.String localName)
      Look up an attribute's type by Namespace-qualified name.
      java.lang.String getURI​(int index)
      Return an attribute's Namespace URI.
      java.lang.String getValue​(int index)
      Return an attribute's value by index.
      java.lang.String getValue​(java.lang.String qName)
      Look up an attribute's value by qualified (prefixed) name.
      java.lang.String getValue​(java.lang.String uri, java.lang.String localName)
      Look up an attribute's value by Namespace-qualified name.
      • Methods inherited from class java.lang.Object

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

      • NullAttributes

        public NullAttributes()
    • Method Detail

      • getLength

        public int getLength()
        Return the number of attributes in the 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 index)
        Return an attribute's Namespace URI.
        Specified by:
        getURI in interface org.xml.sax.Attributes
        Parameters:
        index - The attribute's index (zero-based).
        Returns:
        The Namespace URI, the empty string if none is available, or null if the index is out of range.
        See Also:
        Attributes.getURI(int)
      • getLocalName

        public java.lang.String getLocalName​(int index)
        Return an attribute's local name.
        Specified by:
        getLocalName in interface org.xml.sax.Attributes
        Parameters:
        index - The attribute's index (zero-based).
        Returns:
        The attribute's local name, the empty string if none is available, or null if the index if out of range.
        See Also:
        Attributes.getLocalName(int)
      • getQName

        public java.lang.String getQName​(int index)
        Return an attribute's qualified (prefixed) name.
        Specified by:
        getQName in interface org.xml.sax.Attributes
        Parameters:
        index - The attribute's index (zero-based).
        Returns:
        The attribute's qualified name, the empty string if none is available, or null if the index is out of bounds.
        See Also:
        Attributes.getQName(int)
      • getType

        public java.lang.String getType​(int index)
        Return an attribute's type by index.
        Specified by:
        getType in interface org.xml.sax.Attributes
        Parameters:
        index - The attribute's index (zero-based).
        Returns:
        The attribute's type, "CDATA" if the type is unknown, or null if the index is out of bounds.
        See Also:
        Attributes.getType(int)
      • getValue

        public java.lang.String getValue​(int index)
        Return an attribute's value by index.
        Specified by:
        getValue in interface org.xml.sax.Attributes
        Parameters:
        index - The attribute's index (zero-based).
        Returns:
        The attribute's value or null if the index is out of bounds.
        See Also:
        Attributes.getValue(int)
      • getIndex

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

        In many cases, it will be more efficient to look up the name once and use the index query methods rather than using the name query methods repeatedly.

        Specified by:
        getIndex in interface org.xml.sax.Attributes
        Parameters:
        uri - The attribute's Namespace URI, or the empty string if none is available.
        localName - The attribute's local name.
        Returns:
        The attribute's index, or -1 if none matches.
        See Also:
        Attributes.getIndex(java.lang.String,java.lang.String)
      • getIndex

        public int getIndex​(java.lang.String qName)
        Look up an attribute's index by qualified (prefixed) name.
        Specified by:
        getIndex in interface org.xml.sax.Attributes
        Parameters:
        qName - The qualified name.
        Returns:
        The attribute's index, or -1 if none matches.
        See Also:
        Attributes.getIndex(java.lang.String)
      • getType

        public java.lang.String getType​(java.lang.String uri,
                                        java.lang.String localName)
        Look up an attribute's type by Namespace-qualified name.
        Specified by:
        getType in interface org.xml.sax.Attributes
        Parameters:
        uri - The Namespace URI, or the empty string for a name with no explicit Namespace URI.
        localName - The local name.
        Returns:
        The attribute's type, or null if there is no matching attribute.
        See Also:
        Attributes.getType(java.lang.String,java.lang.String)
      • getType

        public java.lang.String getType​(java.lang.String qName)
        Look up an attribute's type by qualified (prefixed) name.
        Specified by:
        getType in interface org.xml.sax.Attributes
        Parameters:
        qName - The qualified name.
        Returns:
        The attribute's type, or null if there is no matching attribute.
        See Also:
        Attributes.getType(java.lang.String)
      • getValue

        public java.lang.String getValue​(java.lang.String uri,
                                         java.lang.String localName)
        Look up an attribute's value by Namespace-qualified name.
        Specified by:
        getValue in interface org.xml.sax.Attributes
        Parameters:
        uri - The Namespace URI, or the empty string for a name with no explicit Namespace URI.
        localName - The local name.
        Returns:
        The attribute's value, or null if there is no matching attribute.
        See Also:
        Attributes.getValue(java.lang.String,java.lang.String)
      • getValue

        public java.lang.String getValue​(java.lang.String qName)
        Look up an attribute's value by qualified (prefixed) name.
        Specified by:
        getValue in interface org.xml.sax.Attributes
        Parameters:
        qName - The qualified name.
        Returns:
        The attribute's value, or null if there is no matching attribute.
        See Also:
        Attributes.getValue(java.lang.String)