模块 java.xml

类 AttributeListImpl

java.lang.Object
org.xml.sax.helpers.AttributeListImpl
所有已实现的接口:
AttributeList

@Deprecated (since ="1.5") public class AttributeListImpl extends Object implements AttributeList
已弃用。
此类实现了一个已弃用的接口,AttributeList ;该接口已被 Attributes 取代,它在 AttributesImpl 帮助程序类中实现。
AttributeList 的默认实现。

AttributeList 实现了已弃用的 SAX1 AttributeList 接口,并已被新的 SAX2 AttributesImpl 接口取代。

此类提供 SAX AttributeList 接口的便捷实现。此实现对 SAX 解析器编写者和 SAX 应用程序编写者都有用,前者可使用它为应用程序提供属性,后者可用于创建元素属性规范的持久副本:

 private AttributeList myatts;

 public void startElement (String name, AttributeList atts)
 {
       // create a persistent copy of the attribute list
       // for use outside this method
  myatts = new AttributeListImpl(atts);
  [...]
 }
 

请注意,SAX 解析器不需要使用此类来提供 AttributeList 的实现;它仅作为可选便利提供。特别是,鼓励解析器编写者发明更有效的实现。

自从:
1.4, SAX 1.0
参见:
  • 构造方法详细信息

  • 方法详情

    • setAttributeList

      public void setAttributeList(AttributeList  atts)
      已弃用。
      设置属性列表,丢弃以前的内容。

      此方法允许应用程序编写者轻松地重用属性列表。

      参数:
      atts - 要复制的属性列表。
    • addAttribute

      public void addAttribute(String  name, String  type, String  value)
      已弃用。
      将属性添加到属性列表。

      此方法是为 SAX 解析器编写者提供的,以允许他们在将属性列表交付给应用程序之前逐步构建属性列表。

      参数:
      name - 属性名称。
      type - 属性类型(枚举的“NMTOKEN”)。
      value - 属性值(不能为空)。
      参见:
    • removeAttribute

      public void removeAttribute(String  name)
      已弃用。
      从列表中删除一个属性。

      SAX 应用程序编写者可以使用此方法从 AttributeList 中过滤出一个属性。请注意,调用此方法将更改属性列表的长度和某些属性的索引。

      如果请求的属性不在列表中,则这是一个空操作。

      参数:
      name - 属性名称。
      参见:
    • clear

      public void clear()
      已弃用。
      清除属性列表。

      SAX 解析器编写者可以使用此方法重置 DocumentHandler.startElement 事件之间的属性列表。通常,重用同一个 AttributeListImpl 对象比每次都分配一个新对象更有意义。

      参见:
    • getLength

      public int getLength()
      已弃用。
      返回列表中的属性数。
      指定者:
      getLength 在接口 AttributeList
      返回:
      列表中的属性数。
      参见:
    • getName

      public String  getName(int i)
      已弃用。
      获取属性的名称(按位置)。
      指定者:
      getName 在接口 AttributeList
      参数:
      i - 属性在列表中的位置。
      返回:
      作为字符串的属性名称,如果该位置没有属性,则为 null。
      参见:
    • getType

      public String  getType(int i)
      已弃用。
      获取属性的类型(按位置)。
      指定者:
      getType 在接口 AttributeList
      参数:
      i - 属性在列表中的位置。
      返回:
      作为字符串的属性类型(枚举为“NMTOKEN”,如果没有读取声明则为“CDATA”),如果该位置没有属性则为 null。
      参见:
    • getValue

      public String  getValue(int i)
      已弃用。
      获取属性的值(按位置)。
      指定者:
      getValue 在接口 AttributeList
      参数:
      i - 属性在列表中的位置。
      返回:
      作为字符串的属性值,如果该位置没有属性,则为 null。
      参见:
    • getType

      public String  getType(String  name)
      已弃用。
      获取属性的类型(按名称)。
      指定者:
      getType 在接口 AttributeList
      参数:
      name - 属性名称。
      返回:
      作为字符串的属性类型(枚举为“NMTOKEN”,如果未读取声明则为“CDATA”)。
      参见:
    • getValue

      public String  getValue(String  name)
      已弃用。
      获取属性的值(按名称)。
      指定者:
      getValue 在接口 AttributeList
      参数:
      name - 属性名称。
      返回:
      作为字符串的属性值,如果不存在此类属性,则为 null。
      参见: