public final class AttributesProxy
extends java.lang.Object
implements org.xml.sax.AttributeList, org.xml.sax.ext.Attributes2
XMLAttributes
and makes it look like
AttributeList
and Attributes2
.Constructor and Description |
---|
AttributesProxy(org.apache.xerces.xni.XMLAttributes attributes) |
Modifier and Type | Method and Description |
---|---|
org.apache.xerces.xni.XMLAttributes |
getAttributes() |
int |
getIndex(java.lang.String qName)
Look up the index of an attribute by XML qualified (prefixed) name.
|
int |
getIndex(java.lang.String uri,
java.lang.String localPart)
Look up the index of an attribute by Namespace name.
|
int |
getLength()
Return the number of attributes in this list.
|
java.lang.String |
getLocalName(int index)
Look up an attribute's local name by index.
|
java.lang.String |
getName(int i)
Return the name of an attribute in this list (by position).
|
java.lang.String |
getQName(int index)
Look up an attribute's XML qualified (prefixed) name by index.
|
java.lang.String |
getType(int i)
Return the type of an attribute in the list (by position).
|
java.lang.String |
getType(java.lang.String name)
Return the type of an attribute in the list (by name).
|
java.lang.String |
getType(java.lang.String uri,
java.lang.String localName)
Look up an attribute's type by Namespace name.
|
java.lang.String |
getURI(int index)
Look up an attribute's Namespace URI by index.
|
java.lang.String |
getValue(int i)
Return the value of an attribute in the list (by position).
|
java.lang.String |
getValue(java.lang.String name)
Return the value of an attribute in the list (by name).
|
java.lang.String |
getValue(java.lang.String uri,
java.lang.String localName)
Look up an attribute's value by Namespace name.
|
boolean |
isDeclared(int index)
Returns false unless the attribute was declared in the DTD.
|
boolean |
isDeclared(java.lang.String qName)
Returns false unless the attribute was declared in the DTD.
|
boolean |
isDeclared(java.lang.String uri,
java.lang.String localName)
Returns false unless the attribute was declared in the DTD.
|
boolean |
isSpecified(int index)
Returns true unless the attribute value was provided
by DTD defaulting.
|
boolean |
isSpecified(java.lang.String qName)
Returns true unless the attribute value was provided
by DTD defaulting.
|
boolean |
isSpecified(java.lang.String uri,
java.lang.String localName)
Returns true unless the attribute value was provided
by DTD defaulting.
|
void |
setAttributes(org.apache.xerces.xni.XMLAttributes attributes)
Sets the XML attributes to be wrapped.
|
public AttributesProxy(org.apache.xerces.xni.XMLAttributes attributes)
public void setAttributes(org.apache.xerces.xni.XMLAttributes attributes)
public org.apache.xerces.xni.XMLAttributes getAttributes()
public int getLength()
org.xml.sax.AttributeList
The SAX parser may provide attributes in any arbitrary order, regardless of the order in which they were declared or specified. The number of attributes may be zero.
getLength
in interface org.xml.sax.AttributeList
getLength
in interface org.xml.sax.Attributes
Attributes.getURI(int)
,
Attributes.getLocalName(int)
,
Attributes.getQName(int)
,
Attributes.getType(int)
,
Attributes.getValue(int)
public java.lang.String getQName(int index)
org.xml.sax.Attributes
getQName
in interface org.xml.sax.Attributes
index
- The attribute index (zero-based).Attributes.getLength()
public java.lang.String getURI(int index)
org.xml.sax.Attributes
getURI
in interface org.xml.sax.Attributes
index
- The attribute index (zero-based).Attributes.getLength()
public java.lang.String getLocalName(int index)
org.xml.sax.Attributes
getLocalName
in interface org.xml.sax.Attributes
index
- The attribute index (zero-based).Attributes.getLength()
public java.lang.String getType(int i)
org.xml.sax.AttributeList
The attribute type is one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION" (always in upper case).
If the parser has not read a declaration for the attribute, or if the parser does not report attribute types, then it must return the value "CDATA" as stated in the XML 1.0 Recommentation (clause 3.3.3, "Attribute-Value Normalization").
For an enumerated attribute that is not a notation, the parser will report the type as "NMTOKEN".
getType
in interface org.xml.sax.AttributeList
getType
in interface org.xml.sax.Attributes
i
- The index of the attribute in the list (starting at 0).AttributeList.getLength()
,
AttributeList.getType(java.lang.String)
public java.lang.String getType(java.lang.String name)
org.xml.sax.AttributeList
The return value is the same as the return value for getType(int).
If the attribute name has a namespace prefix in the document, the application must include the prefix here.
getType
in interface org.xml.sax.AttributeList
getType
in interface org.xml.sax.Attributes
name
- The name of the attribute.AttributeList.getType(int)
public java.lang.String getType(java.lang.String uri, java.lang.String localName)
org.xml.sax.Attributes
See getType(int)
for a description
of the possible types.
getType
in interface org.xml.sax.Attributes
uri
- The Namespace URI, or the empty String if the
name has no Namespace URI.localName
- The local name of the attribute.public java.lang.String getValue(int i)
org.xml.sax.AttributeList
If the attribute value is a list of tokens (IDREFS, ENTITIES, or NMTOKENS), the tokens will be concatenated into a single string separated by whitespace.
getValue
in interface org.xml.sax.AttributeList
getValue
in interface org.xml.sax.Attributes
i
- The index of the attribute in the list (starting at 0).AttributeList.getLength()
,
AttributeList.getValue(java.lang.String)
public java.lang.String getValue(java.lang.String name)
org.xml.sax.AttributeList
The return value is the same as the return value for getValue(int).
If the attribute name has a namespace prefix in the document, the application must include the prefix here.
getValue
in interface org.xml.sax.AttributeList
getValue
in interface org.xml.sax.Attributes
name
- the name of the attribute to returnAttributeList.getValue(int)
public java.lang.String getValue(java.lang.String uri, java.lang.String localName)
org.xml.sax.Attributes
See getValue(int)
for a description
of the possible values.
getValue
in interface org.xml.sax.Attributes
uri
- The Namespace URI, or the empty String if the
name has no Namespace URI.localName
- The local name of the attribute.public int getIndex(java.lang.String qName)
org.xml.sax.Attributes
getIndex
in interface org.xml.sax.Attributes
qName
- The qualified (prefixed) name.public int getIndex(java.lang.String uri, java.lang.String localPart)
org.xml.sax.Attributes
getIndex
in interface org.xml.sax.Attributes
uri
- The Namespace URI, or the empty string if
the name has no Namespace URI.localPart
- The attribute's local name.public boolean isDeclared(int index)
org.xml.sax.ext.Attributes2
isDeclared
in interface org.xml.sax.ext.Attributes2
index
- The attribute index (zero-based).public boolean isDeclared(java.lang.String qName)
org.xml.sax.ext.Attributes2
isDeclared
in interface org.xml.sax.ext.Attributes2
qName
- The XML qualified (prefixed) name.public boolean isDeclared(java.lang.String uri, java.lang.String localName)
org.xml.sax.ext.Attributes2
Remember that since DTDs do not "understand" namespaces, the namespace URI associated with an attribute may not have come from the DTD. The declaration will have applied to the attribute's qName.
isDeclared
in interface org.xml.sax.ext.Attributes2
uri
- The Namespace URI, or the empty string if
the name has no Namespace URI.localName
- The attribute's local name.public boolean isSpecified(int index)
org.xml.sax.ext.Attributes2
isSpecified
in interface org.xml.sax.ext.Attributes2
index
- The attribute index (zero-based).public boolean isSpecified(java.lang.String qName)
org.xml.sax.ext.Attributes2
isSpecified
in interface org.xml.sax.ext.Attributes2
qName
- The XML qualified (prefixed) name.public boolean isSpecified(java.lang.String uri, java.lang.String localName)
org.xml.sax.ext.Attributes2
Remember that since DTDs do not "understand" namespaces, the namespace URI associated with an attribute may not have come from the DTD. The declaration will have applied to the attribute's qName.
isSpecified
in interface org.xml.sax.ext.Attributes2
uri
- The Namespace URI, or the empty string if
the name has no Namespace URI.localName
- The attribute's local name.public java.lang.String getName(int i)
org.xml.sax.AttributeList
The names must be unique: the SAX parser shall not include the same attribute twice. Attributes without values (those declared #IMPLIED without a value specified in the start tag) will be omitted from the list.
If the attribute name has a namespace prefix, the prefix will still be attached.
getName
in interface org.xml.sax.AttributeList
i
- The index of the attribute in the list (starting at 0).AttributeList.getLength()
Copyright © 1999-2022 The Apache Software Foundation. All Rights Reserved.