- java.lang.Object
-
- org.xml.sax.helpers.AttributeListImpl
-
- 实现的所有接口
-
AttributeList
@Deprecated(since="1.5") public class AttributeListImpl extends Object implements AttributeList
Deprecated.This class implements a deprecated interface,AttributeList; that interface has been replaced byAttributes, which is implemented in theAttributesImplhelper class.AttributeList的默认实现。This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY. See http://www.saxproject.org for further information.
AttributeList实现了不推荐使用的SAX1
AttributeList接口,并已被新的SAX2AttributesImpl接口取代。该类提供了SAX
AttributeList接口的便捷实现。 此实现对于SAX解析器编写者(可以使用它为应用程序提供属性)以及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
- 另请参见:
-
AttributeList,DocumentHandler.startElement(java.lang.String, org.xml.sax.AttributeList)
-
-
构造方法摘要
构造方法 构造器 描述 AttributeListImpl()已过时。创建一个空属性列表。AttributeListImpl(AttributeList atts)已过时。构造现有属性列表的持久副本。
-
方法摘要
所有方法 实例方法 具体的方法 弃用的方法 变量和类型 方法 描述 voidaddAttribute(String name, String type, String value)已过时。将属性添加到属性列表。voidclear()已过时。清除属性列表。intgetLength()已过时。返回列表中的属性数。StringgetName(int i)已过时。获取属性的名称(按位置)。StringgetType(int i)已过时。获取属性的类型(按位置)。StringgetType(String name)已过时。获取属性的类型(按名称)。StringgetValue(int i)已过时。获取属性的值(按位置)。StringgetValue(String name)已过时。获取属性的值(按名称)。voidremoveAttribute(String name)已过时。从列表中删除属性。voidsetAttributeList(AttributeList atts)已过时。设置属性列表,丢弃以前的内容。
-
-
-
构造方法详细信息
-
AttributeListImpl
public AttributeListImpl()
Deprecated.创建一个空属性列表。此构造函数对解析器编写者最有用,解析器编写者将使用它来创建单个可重用的属性列表,该列表可以使用元素之间的clear方法重置。
-
AttributeListImpl
public AttributeListImpl(AttributeList atts)
Deprecated.构造现有属性列表的持久副本。此构造函数对应用程序编写者最有用,他们将使用它来创建现有属性列表的持久副本。
- 参数
-
atts- 要复制的属性列表 - 另请参见:
-
DocumentHandler.startElement(java.lang.String, org.xml.sax.AttributeList)
-
-
方法详细信息
-
setAttributeList
public void setAttributeList(AttributeList atts)
Deprecated.设置属性列表,丢弃以前的内容。此方法允许应用程序编写者轻松地重用属性列表。
- 参数
-
atts- 要复制的属性列表。
-
addAttribute
public void addAttribute(String name, String type, String value)
Deprecated.将属性添加到属性列表。为SAX解析器编写器提供了此方法,以允许它们在将属性列表传递给应用程序之前逐步构建属性列表。
- 参数
-
name- 属性名称。 -
type- 属性类型(枚举的“NMTOKEN”)。 -
value- 属性值(不能为null)。 - 另请参见:
-
removeAttribute(java.lang.String),DocumentHandler.startElement(java.lang.String, org.xml.sax.AttributeList)
-
removeAttribute
public void removeAttribute(String name)
Deprecated.从列表中删除属性。SAX应用程序编写者可以使用此方法从AttributeList中过滤属性。 请注意,调用此方法将更改属性列表的长度和某些属性的索引。
如果请求的属性不在列表中,则这是无操作。
- 参数
-
name- 属性名称。 - 另请参见:
-
addAttribute(java.lang.String, java.lang.String, java.lang.String)
-
clear
public void clear()
Deprecated.清除属性列表。SAX解析器编写器可以使用此方法重置DocumentHandler.startElement事件之间的属性列表。 通常,重用相同的AttributeListImpl对象而不是每次都分配一个新对象是有意义的。
-
getLength
public int getLength()
Deprecated.返回列表中的属性数。- Specified by:
-
getLength接口AttributeList - 结果
- 列表中的属性数。
- 另请参见:
-
AttributeList.getLength()
-
getName
public String getName(int i)
Deprecated.获取属性的名称(按位置)。- Specified by:
-
getName接口AttributeList - 参数
-
i- 列表中属性的位置。 - 结果
- 属性名称为字符串,如果该位置没有属性,则为null。
- 另请参见:
-
AttributeList.getName(int)
-
getType
public String getType(int i)
Deprecated.获取属性的类型(按位置)。- Specified by:
-
getType接口AttributeList - 参数
-
i- 列表中属性的位置。 - 结果
- 属性类型为字符串(枚举为“NMTOKEN”,如果未读取任何声明,则为“CDATA”),如果该位置没有属性,则为null。
- 另请参见:
-
AttributeList.getType(int)
-
getValue
public String getValue(int i)
Deprecated.获取属性的值(按位置)。- Specified by:
-
getValue接口AttributeList - 参数
-
i- 列表中属性的位置。 - 结果
- 属性值为字符串,如果该位置没有属性,则为null。
- 另请参见:
-
AttributeList.getValue(int)
-
getType
public String getType(String name)
Deprecated.获取属性的类型(按名称)。- Specified by:
-
getType接口AttributeList - 参数
-
name- 属性名称。 - 结果
- 属性类型为字符串(枚举为“NMTOKEN”,如果未读取任何声明,则为“CDATA”)。
- 另请参见:
-
AttributeList.getType(java.lang.String)
-
getValue
public String getValue(String name)
Deprecated.获取属性的值(按名称)。- Specified by:
-
getValue接口AttributeList - 参数
-
name- 属性名称。 - 结果
- 属性值为字符串,如果不存在此属性,则为null。
- 另请参见:
-
AttributeList.getValue(java.lang.String)
-
-