public interface Attributes
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.
此接口允许访问三种不同的方式的属性列表:
列表不包含属性,被宣布#暗示但在开始标签不指定。它也将不包含作为命名空间声明的属性(xmlns *)除非http://xml.org/sax/features/namespace-prefixes
功能设置为真正的(这是假默认)。因为SAX2符合原来的“XML命名空间”的建议,它通常不给属性的命名空间URI命名空间声明。
SAX2解析器可以支持一些使用一个可选的特征标志(http://xml.org/sax/features/xmlns-uris
)要求这些属性被赋予的URI,符合后向后兼容的修改建议。(属性的本地名称”将前缀,或“xmlns”定义一个默认的元素的命名空间。当)携带,处理代码要解决冲突,而不是要求解析器可以改变特征标志的设置。
如果命名空间前缀特征(见上图)是假,由合格的名称访问可能不可用;如果http://xml.org/sax/features/namespaces
特征是假,通过命名空间限定名来访问不可用。
这个接口取代了过时的SAX1 AttributeList
接口,其中不包含命名空间的支持。除了命名空间支持,增加了getindex方法(下)。
列表中的属性的顺序是未指定的,并且将从实现到实现有所不同。
Modifier and Type | Method and Description |
---|---|
int |
getIndex(String qName)
查合格的XML属性指标(前缀)的名字。
|
int |
getIndex(String uri, String localName)
用命名空间名称查找属性的索引。
|
int |
getLength()
返回列表中的属性的数目。
|
String |
getLocalName(int index)
用索引查找属性的本地名称。
|
String |
getQName(int index)
看一个属性的XML合格(前缀)名称索引。
|
String |
getType(int index)
用索引查找属性的类型。
|
String |
getType(String qName)
查合格的XML属性的类型(前缀)的名字。
|
String |
getType(String uri, String localName)
通过命名空间名称查找属性的类型。
|
String |
getURI(int index)
看一个属性的命名空间URI的指数。
|
String |
getValue(int index)
用索引查找属性的值。
|
String |
getValue(String qName)
查一个属性的值由XML合格(前缀)的名字。
|
String |
getValue(String uri, String localName)
通过命名空间名称查找属性的值。
|
int getLength()
一旦你知道数量的属性,你可以遍历列表。
getURI(int)
,
getLocalName(int)
,
getQName(int)
,
getType(int)
,
getValue(int)
String getURI(int index)
index
-属性索引(从零开始)。
getLength()
String getLocalName(int index)
index
-属性索引(从零开始)。
getLength()
String getQName(int index)
index
-属性索引(从零开始)。
getLength()
String getType(int index)
属性的类型是一个字符串“我”、“本我”、“象征”、“IDREFS”、“象征”、“这些”、“实体”,“实体”,或“符号”(大写)。
如果解析器未读的属性声明,或如果解析器不报告的属性类型,那么它必须返回值“是”作为XML 1推荐说明(第3.3.3,”属性值标准化”)。
对于一个枚举属性,不是一个符号,解析器将报告类型为“象征”。
index
-属性索引(从零开始)。
getLength()
String getValue(int index)
如果属性值是一个列表的标记(IDREFS,实体,或NMTOKENS),令牌将被连接成一个与每个标记用一个空格隔开单个字符串。
index
-属性索引(从零开始)。
getLength()
int getIndex(String uri, String localName)
uri
的命名空间URI或空字符串,如果名字没有命名空间URI。
localName
-属性的本地名称。
int getIndex(String qName)
qName
-合格(前缀)的名字。
String getType(String uri, String localName)
看到一个描述可能的类型getType(int)
。
uri
的命名空间URI或空字符串,如果名字没有命名空间URI。
localName
-属性的本地名称。
String getType(String qName)
看到一个描述可能的类型getType(int)
。
qName
- XML限定名。
String getValue(String uri, String localName)
看到一个描述可能的值getValue(int)
。
uri
的命名空间URI或空字符串,如果名字没有命名空间URI。
localName
-属性的本地名称。
String getValue(String qName)
看到一个描述可能的值getValue(int)
。
qName
- XML限定名。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.