public class AttributeCollectionImpl
extends java.lang.Object
implements org.xml.sax.Attributes
As well as providing the information required by the SAX2 interface, an
AttributeCollection can hold type information (as needed to support the JAXP 1.3
ValidatorHandler
interface), and location information
for debugging. The location information is used in the case of attributes on a result
tree to identify the location in the query or stylesheet from which they were
generated.
Constructor and Description |
---|
AttributeCollectionImpl(Configuration config,
int initialSize) |
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(NodeName nodeName,
SimpleType type,
java.lang.String value,
Location locationId,
int properties)
Add an attribute to an attribute list.
|
int |
getIndex(java.lang.String qname)
Get the index of an attribute, from its lexical QName
|
int |
getIndex(java.lang.String uri,
java.lang.String localname)
Get the index of an attribute (by name).
|
int |
getLength()
Return the number of attributes in the list.
|
java.lang.String |
getLocalName(int index)
Get the local name of an attribute (by position).
|
Location |
getLocation(int index)
Get the location of an attribute (by position)
|
int |
getProperties(int index)
Get the properties of an attribute (by position)
|
java.lang.String |
getQName(int index)
Get the lexical QName of an attribute (by position).
|
java.lang.String |
getType(int index)
Get the type of an attribute (by position).
|
java.lang.String |
getType(java.lang.String name)
Get the type of an attribute (by lexical QName).
|
java.lang.String |
getType(java.lang.String uri,
java.lang.String localname)
Get the type of an attribute (by name).
|
SimpleType |
getTypeAnnotation(int index)
Get the type of an attribute (by position).
|
java.lang.String |
getURI(int index)
Get the namespace URI of an attribute (by position).
|
java.lang.String |
getValue(int index)
Get the value of an attribute (by position).
|
java.lang.String |
getValue(java.lang.String name)
Get the value of an attribute (by lexnical QName).
|
java.lang.String |
getValue(java.lang.String uri,
java.lang.String localname)
Get the value of an attribute (by name).
|
void |
setAttribute(AttributeInfo attribute)
Add an attribute to the collection, replacing any existing attribute
with the same name
|
void |
setAttribute(int index,
NodeName nodeName,
SimpleType type,
java.lang.String value,
Location locationId,
int properties)
Set (overwrite) an attribute in the attribute list.
|
void |
setTypeAnnotation(int index,
SimpleType type)
Set the type annotation of an attribute
|
public AttributeCollectionImpl(Configuration config, int initialSize)
public void addAttribute(NodeName nodeName, SimpleType type, java.lang.String value, Location locationId, int properties)
Outputter.attribute(NodeName, SimpleType, CharSequence, Location, int)
method. There is no check that the name of the attribute is distinct from other attributes
already in the collection: this check must be made by the caller.nodeName
- Object representing the attribute name.type
- The attribute typevalue
- The attribute value (must not be null)locationId
- Identifies the attribute location.properties
- Attribute propertiespublic void setAttribute(int index, NodeName nodeName, SimpleType type, java.lang.String value, Location locationId, int properties)
Outputter.attribute(NodeName, SimpleType, CharSequence, Location, int)
method.index
- Identifies the entry to be replaced. Must be in range (nasty things happen if not)nodeName
- representing the attribute name.type
- The attribute type codevalue
- The attribute value (must not be null)locationId
- Identifies the attribtue location.properties
- Attribute propertiespublic int getLength()
getLength
in interface org.xml.sax.Attributes
public SimpleType getTypeAnnotation(int index)
index
- The position of the attribute in the list.public Location getLocation(int index)
index
- The position of the attribute in the list.public int getProperties(int index)
index
- The position of the attribute in the list.ReceiverOption
. The
most interesting of these is {ReceiverOption.DEFAULTED_VALUE
,
which indicates an attribute that was added to an element as a result of schema validation.public java.lang.String getQName(int index)
getQName
in interface org.xml.sax.Attributes
index
- The position of the attribute in the list.public java.lang.String getLocalName(int index)
getLocalName
in interface org.xml.sax.Attributes
index
- The position of the attribute in the list.public java.lang.String getURI(int index)
getURI
in interface org.xml.sax.Attributes
index
- The position of the attribute in the list.public java.lang.String getType(int index)
getType
in interface org.xml.sax.Attributes
index
- The position of the attribute in the list.public java.lang.String getType(java.lang.String uri, java.lang.String localname)
getType
in interface org.xml.sax.Attributes
uri
- The namespace uri of the attribute.localname
- The local name of the attribute.public java.lang.String getValue(int index)
getValue
in interface org.xml.sax.Attributes
index
- The position of the attribute in the list.public java.lang.String getValue(java.lang.String uri, java.lang.String localname)
getValue
in interface org.xml.sax.Attributes
uri
- The namespace uri of the attribute.localname
- The local name of the attribute.public int getIndex(java.lang.String qname)
getIndex
in interface org.xml.sax.Attributes
qname
- The lexical QName of the attribute. The prefix must match.public int getIndex(java.lang.String uri, java.lang.String localname)
getIndex
in interface org.xml.sax.Attributes
uri
- The namespace uri of the attribute.localname
- The local name of the attribute.public java.lang.String getType(java.lang.String name)
getType
in interface org.xml.sax.Attributes
name
- The lexical QName of the attribute.public java.lang.String getValue(java.lang.String name)
getValue
in interface org.xml.sax.Attributes
name
- The attribute name (a lexical QName).
The prefix must match the prefix originally used. This method is defined in SAX, but is
not recommended except where the prefix is null.public void setTypeAnnotation(int index, SimpleType type)
index
- the index position of the attribute nodetype
- the new type for the attributepublic void setAttribute(AttributeInfo attribute)
attribute
- the attribute to be added to the collectionCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.