- java.lang.Object
-
- org.xml.sax.helpers.AttributeListImpl
-
- All Implemented Interfaces:
-
AttributeList
已过时。此类实现了不推荐的接口,AttributeList; 那个界面已被Attributes替代,它是在AttributesImpl帮助类中实现的。
public class AttributeListImpl extends Object implements AttributeList
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应用程序编写者来说都是有用的: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)
-
-
构造方法摘要
构造方法 Constructor 描述 AttributeListImpl()已过时。创建一个空属性列表。AttributeListImpl(AttributeList atts)已过时。构造一个现有属性列表的永久性副本。
-
方法摘要
所有方法 接口方法 具体的方法 弃用的方法 Modifier and Type 方法 描述 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()
已过时。创建一个空属性列表。这个构造函数对于解析器作者最有用,他们将使用它来创建一个可重用的属性列表,该列表可以通过元素之间的清除方法重置。
-
AttributeListImpl
public AttributeListImpl(AttributeList atts)
已过时。构造一个现有属性列表的永久性副本。这个构造函数对于应用程序编写者来说是最有用的,他们将使用它来创建现有属性列表的持久性副本。
- 参数
-
atts- 要复制的属性列表 - 另请参见:
-
DocumentHandler.startElement(java.lang.String, org.xml.sax.AttributeList)
-
-
方法详细信息
-
setAttributeList
public void setAttributeList(AttributeList atts)
已过时。设置属性列表,舍弃以前的内容。该方法允许应用程序写入程序轻松重用属性列表。
- 参数
-
atts- 要复制的属性列表。
-
addAttribute
public void addAttribute(String name, String type, String value)
已过时。将属性添加到属性列表。为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)
已过时。从列表中删除一个属性。SAX应用程序编写者可以使用此方法从属性列表中过滤属性。 请注意,调用此方法将更改属性列表的长度和某些属性的索引。
如果所请求的属性不在列表中,那么这是一个no-op。
- 参数
-
name- 属性名称。 - 另请参见:
-
addAttribute(java.lang.String, java.lang.String, java.lang.String)
-
clear
public void clear()
已过时。清除属性列表。SAX解析器编写者可以使用此方法在DocumentHandler.startElement事件之间重置属性列表。 通常,重复使用相同的AttributeListImpl对象,而不是每次分配一个新对象是有意义的。
-
getLength
public int getLength()
已过时。返回列表中的属性数。- Specified by:
-
getLength在接口AttributeList - 结果
- 列表中的属性数。
- 另请参见:
-
AttributeList.getLength()
-
getName
public String getName(int i)
已过时。获取属性的名称(按位置)。- Specified by:
-
getName在接口AttributeList - 参数
-
i- 属性在列表中的位置。 - 结果
- 属性名称作为字符串,如果该位置没有属性,则为null。
- 另请参见:
-
AttributeList.getName(int)
-
getType
public String getType(int i)
已过时。获取属性的类型(按位置)。- Specified by:
-
getType在接口AttributeList - 参数
-
i- 属性在列表中的位置。 - 结果
- 属性类型为字符串(枚举的“NMTOKEN”,如果没有声明,则为“CDATA”),如果该位置没有属性,则为空。
- 另请参见:
-
AttributeList.getType(int)
-
getValue
public String getValue(int i)
已过时。获取属性的值(按位置)。- Specified by:
-
getValue在接口AttributeList - 参数
-
i- 属性在列表中的位置。 - 结果
- 属性值作为字符串,如果在该位置没有属性,则为null。
- 另请参见:
-
AttributeList.getValue(int)
-
getType
public String getType(String name)
已过时。获取属性的类型(按名称)。- Specified by:
-
getType在接口AttributeList - 参数
-
name- 属性名称。 - 结果
- 属性类型为字符串(枚举的“NMTOKEN”,如果未读取声明则为“CDATA”)。
- 另请参见:
-
AttributeList.getType(java.lang.String)
-
getValue
public String getValue(String name)
已过时。获取属性的值(按名称)。- Specified by:
-
getValue在接口AttributeList - 参数
-
name- 属性名称。 - 结果
- 属性值作为字符串,如果不存在此属性,则为null。
- 另请参见:
-
AttributeList.getValue(java.lang.String)
-
-