public class Attributes2Impl extends AttributesImpl implements Attributes2
Attributes2接口。
This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY.
这不是仅核心的SAX2发行版的一部分。
每个属性的指定标志将始终为真,除非在复制构造函数中将其设置为false,否则使用setSpecified(int, boolean) 。 类似地,除了默认属性( 指定为false),非CDATA属性,或使用setDeclared(int, boolean)设置为true时,每个属性的声明标志将始终为false。 如果您手动更改属性的类型,则可能需要修改其声明的标志才能匹配。
| Constructor and Description |
|---|
Attributes2Impl()
构造一个新的,空的Attributes2Impl对象。
|
Attributes2Impl(Attributes atts)
复制现有的Attributes或Attributes2对象。
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(String uri, String localName, String qName, String type, String value)
将属性添加到列表的末尾,将其“指定”标志设置为true。
|
boolean |
isDeclared(int index)
返回属性的“声明”标志的当前值。
|
boolean |
isDeclared(String qName)
返回属性的“声明”标志的当前值。
|
boolean |
isDeclared(String uri, String localName)
返回属性的“声明”标志的当前值。
|
boolean |
isSpecified(int index)
返回属性的“指定”标志的当前值。
|
boolean |
isSpecified(String qName)
返回属性的“指定”标志的当前值。
|
boolean |
isSpecified(String uri, String localName)
返回属性的“指定”标志的当前值。
|
void |
removeAttribute(int index)
从列表中删除一个属性。
|
void |
setAttributes(Attributes atts)
复制整个Attributes对象。
|
void |
setDeclared(int index, boolean value)
将值分配给特定属性的“声明”标志。
|
void |
setSpecified(int index, boolean value)
将值分配给特定属性的“指定”标志。
|
clear, getIndex, getIndex, getLength, getLocalName, getQName, getType, getType, getType, getURI, getValue, getValue, getValue, setAttribute, setLocalName, setQName, setType, setURI, setValuepublic Attributes2Impl()
public Attributes2Impl(Attributes atts)
这个构造函数在startElement事件中特别有用。
atts - 现有的属性对象。
public boolean isDeclared(int index)
isDeclared在界面
Attributes2
index - 属性索引(从零开始)。
public boolean isDeclared(String uri, String localName)
isDeclared在界面
Attributes2
uri - 命名空间URI,如果名称没有命名空间URI,则为空字符串。
localName - 属性的本地名称。
public boolean isDeclared(String qName)
isDeclared在接口
Attributes2
qName - XML合格(前缀)名称。
public boolean isSpecified(int index)
isSpecified在界面
Attributes2
index - 属性索引(从零开始)。
ArrayIndexOutOfBoundsException - 当提供的索引未标识属性时。
public boolean isSpecified(String uri, String localName)
isSpecified在界面
Attributes2
uri - 名称空间URI,如果名称没有命名空间URI,则为空字符串。
localName - 属性的本地名称。
IllegalArgumentException - 提供的名称不标识属性时。
public boolean isSpecified(String qName)
isSpecified在界面
Attributes2
qName - XML合格(前缀)名称。
IllegalArgumentException - 提供的名称不标识属性时。
public void setAttributes(Attributes atts)
setAttributes在类
AttributesImpl
atts - 要复制的属性。
AttributesImpl.setAttributes(org.xml.sax.Attributes)
public void addAttribute(String uri, String localName, String qName, String type, String value)
setSpecified(int, boolean) 。
除非属性类型是CDATA,否则此属性被标记为在DTD中声明。 要将该标志的值设置为CDATA属性的值,请使用setDeclared(int, boolean) 。
addAttribute在类别
AttributesImpl
uri - 命名空间URI,或空字符串,如果没有可用或命名空间处理未被执行。
localName - 如果未执行命名空间处理,
localName本地名称或空字符串。
qName - 合格(前缀)名称,如果限定名称不可用,则为空字符串。
type - 属性类型为字符串。
value - 属性值。
AttributesImpl.addAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void removeAttribute(int index)
AttributesImpl
removeAttribute在类别
AttributesImpl
index -
index的索引(从零开始)。
public void setDeclared(int index,
boolean value)
index -
index的索引(从零开始)。
value - 所需的标志值。
ArrayIndexOutOfBoundsException - 当提供的索引未标识属性时。
AttributesImpl.setType(int, java.lang.String)
public void setSpecified(int index,
boolean value)
index -
index的索引(从零开始)。
value - 所需的标志值。
ArrayIndexOutOfBoundsException - When the supplied index does not identify an attribute.
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.