Team LiB
Previous Section Next Section

AttributesImplorg.xml.sax.helpers

Java 1.4

This utility class is a general-purpose implementation of the Attributes interface. In addition to implementing all the methods of Attributes, it also defines various set methods for setting attribute names, values, and types, an addAttribute( ) method for adding a new attribute to the end of the list, a removeAttribute( ) method for removing an attribute from the list, and a clear( ) method for removing all attributes. Also, there is an AttributesImpl( ) constructor that initializes the new AttributesImpl object with a copy of a specified Attributes object. This class is useful for XMLFilter implementations that want to filter the attributes of an element, or for ContentHandler implementations that need to make and save a copy of an Attributes object for later use.

Figure 22-14. org.xml.sax.helpers.AttributesImpl


public class AttributesImpl implements org.xml.sax.Attributes {
// Public Constructors
     public AttributesImpl( );  
     public AttributesImpl(org.xml.sax.Attributes atts);  
// Public Instance Methods
     public void addAttribute(String uri, String localName, String qName, 
        String type, String value);  
     public void clear( );  
     public void removeAttribute(int index);  
     public void setAttribute(int index, String uri, String localName, 
        String qName, String type, String value);  
     public void setAttributes(org.xml.sax.Attributes atts);  
     public void setLocalName(int index, String localName);  
     public void setQName(int index, String qName);  
     public void setType(int index, String type);  
     public void setURI(int index, String uri);  
     public void setValue(int index, String value);  
// Methods Implementing Attributes
     public int getIndex(String qName);  
     public int getIndex(String uri, String localName);  
     public int getLength( );                            default:0
     public String getLocalName(int index);  
     public String getQName(int index);  
     public String getType(String qName);  
     public String getType(int index);  
     public String getType(String uri, String localName);  
     public String getURI(int index);  
     public String getValue(int index);  
     public String getValue(String qName);  
     public String getValue(String uri, String localName);  
}

Subclasses

org.xml.sax.ext.Attributes2Impl

    Team LiB
    Previous Section Next Section