Class XMLWriterSAX.AttributesImpl

java.lang.Object
com.topologi.diffx.xml.sax.XMLWriterSAX.AttributesImpl
All Implemented Interfaces:
Attributes
Enclosing class:
XMLWriterSAX

private static final class XMLWriterSAX.AttributesImpl extends Object implements Attributes
A SAX attribute list implementation.

Note: the type of all attributes is CDATA.

Version:
25 May 2005
  • Field Details

    • CDATA

      private static final String CDATA
      The only type used in this class.
      See Also:
    • uris

      private final List<String> uris
      Namespace URIs of the attributes.
    • names

      private final List<String> names
      QNames of the attributes.
    • values

      private final List<String> values
      Values of the attributes.
  • Constructor Details

    • AttributesImpl

      public AttributesImpl()
      Creates an empty attribute list.
  • Method Details

    • addAttribute

      public void addAttribute(String name, String value)
      Adds an attribute to an attribute list.
      Parameters:
      name - The attribute name.
      value - The attribute value (must not be null).
      See Also:
    • addAttribute

      public void addAttribute(String uri, String name, String value)
      Adds an attribute to an attribute list.
      Parameters:
      uri - The namespace URI of the attribute
      name - The attribute name.
      value - The attribute value (must not be null).
      See Also:
    • getLength

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

      public String getQName(int i)
      This implementation always returns "".
      Specified by:
      getQName in interface Attributes
      Parameters:
      i - The position of the attribute in the list.
      Returns:
      The attribute qualified name as a string; or null if there is no attribute at that position.
      See Also:
    • getLocalName

      public String getLocalName(int i)
      Returns the name of an attribute (by position).
      Specified by:
      getLocalName in interface Attributes
      Parameters:
      i - The position of the attribute in the list.
      Returns:
      The attribute name as a string; or null if there is no attribute at that position.
      See Also:
    • getType

      public String getType(int i)
      Returns the type of an attribute (by position).
      Specified by:
      getType in interface Attributes
      Parameters:
      i - The position of the attribute in the list.
      Returns:
      The attribute type as "CDATA"; or null if there is no attribute at that position.
      See Also:
    • getValue

      public String getValue(int i)
      Returns the value of an attribute (by position).
      Specified by:
      getValue in interface Attributes
      Parameters:
      i - The position of the attribute in the list.
      Returns:
      The attribute value as a string; or null if there is no attribute at that position.
      See Also:
    • getURI

      public String getURI(int i)
      Returns the namespace URI of an attribute (by position).
      Specified by:
      getURI in interface Attributes
      Parameters:
      i - The position of the attribute in the list.
      Returns:
      The attribute namespace URI as a string; or null if there is no attribute at that position.
      See Also:
    • getType

      public String getType(String qName)
      Returns null as qualified names are not available.
      Specified by:
      getType in interface Attributes
      Parameters:
      qName - The attribute name.
      Returns:
      null
      See Also:
    • getValue

      public String getValue(String name)
      Returns null as qualified names are not available.
      Specified by:
      getValue in interface Attributes
      Parameters:
      name - The attribute name.
      See Also:
    • getType

      public String getType(String uri, String name)
      Returns the type of an attribute (by name).
      Specified by:
      getType in interface Attributes
      Parameters:
      uri - The namespace URI of the attribute.
      name - The attribute name.
      Returns:
      The attribute type as a string ("NMTOKEN" for an enumeration, and "CDATA" if no declaration was read).
      See Also:
    • getValue

      public String getValue(String uri, String name)
      Returns the value of an attribute (by name).
      Specified by:
      getValue in interface Attributes
      Parameters:
      uri - The namespace URI of the attribute.
      name - The attribute name.
      See Also:
    • getIndex

      public int getIndex(String uri, String localName)
      Look up the index of an attribute by Namespace name.
      Specified by:
      getIndex in interface Attributes
      Parameters:
      uri - The Namespace URI, or the empty string if the name has no Namespace URI.
      localName - The attribute's local name.
      Returns:
      The index of the attribute, or -1 if it does not appear in the list.
    • getIndex

      public int getIndex(String qName)
      Look up the index of an attribute by Namespace name.
      Specified by:
      getIndex in interface Attributes
      Parameters:
      qName - The index of the given name.
      Returns:
      The index of the attribute, or -1 if it does not appear in the list.