|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.om.AttributeCollectionImpl
public final class AttributeCollectionImpl
AttributeCollectionImpl is an implementation of both the SAX2 interface Attributes and the Saxon equivalent AttributeCollection.
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.
Field Summary | |
---|---|
static AttributeCollection |
EMPTY_ATTRIBUTE_COLLECTION
|
Constructor Summary | |
---|---|
AttributeCollectionImpl(NamePool pool)
Create an empty attribute list. |
Method Summary | |
---|---|
void |
addAttribute(int nameCode,
int typeCode,
String value,
long locationId,
int properties)
Add an attribute to an attribute list. |
void |
clear()
Clear the attribute list. |
void |
compact()
Compact the attribute list to avoid wasting memory |
int |
getIndex(String qname)
Get the index of an attribute, from its lexical QName |
int |
getIndex(String uri,
String localname)
Get the index of an attribute (by name). |
int |
getIndexByFingerprint(int fingerprint)
Get the index, given the fingerprint. |
int |
getLength()
Return the number of attributes in the list. |
int |
getLineNumber(int index)
Get the line number part of the location of an attribute, at a given index. |
String |
getLocalName(int index)
Get the local name of an attribute (by position). |
int |
getLocationId(int index)
Get the locationID of an attribute (by position) |
int |
getNameCode(int index)
Get the namecode of an attribute (by position). |
String |
getPrefix(int index)
Get the prefix of the name of an attribute (by position). |
int |
getProperties(int index)
Get the properties of an attribute (by position) |
String |
getQName(int index)
Get the lexical QName of an attribute (by position). |
String |
getSystemId(int index)
Get the systemId part of the location of an attribute, at a given index. |
String |
getType(int index)
Get the type of an attribute (by position). |
String |
getType(String name)
Get the type of an attribute (by lexical QName). |
String |
getType(String uri,
String localname)
Get the type of an attribute (by name). |
int |
getTypeAnnotation(int index)
Get the namecode of an attribute (by position). |
String |
getURI(int index)
Get the namespace URI of an attribute (by position). |
String |
getValue(int index)
Get the value of an attribute (by position). |
String |
getValue(String name)
Get the value of an attribute (by lexical QName). |
String |
getValue(String uri,
String localname)
Get the value of an attribute (by name). |
String |
getValueByFingerprint(int fingerprint)
Get the attribute value using its fingerprint |
boolean |
isId(int index)
Determine whether a given attribute has the is-ID property set |
boolean |
isIdref(int index)
Determine whether a given attribute has the is-idref property set |
void |
setAttribute(int index,
int nameCode,
int typeCode,
String value,
long locationId,
int properties)
Set (overwrite) an attribute in the attribute list. |
void |
setLocationProvider(LocationProvider provider)
Set the location provider. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final AttributeCollection EMPTY_ATTRIBUTE_COLLECTION
Constructor Detail |
---|
public AttributeCollectionImpl(NamePool pool)
pool
- the NamePoolMethod Detail |
---|
public void setLocationProvider(LocationProvider provider)
provider
- the location providerpublic void addAttribute(int nameCode, int typeCode, String value, long locationId, int properties)
Receiver.attribute(int,int,CharSequence,int,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.
nameCode
- Integer representing the attribute name.typeCode
- The attribute type codevalue
- The attribute value (must not be null)locationId
- Identifies the attribtue location.properties
- Attribute propertiespublic void setAttribute(int index, int nameCode, int typeCode, String value, long locationId, int properties)
Receiver.attribute(int,int,CharSequence,int,int)
method.
index
- Identifies the entry to be replacednameCode
- Integer representing the attribute name.typeCode
- The attribute type codevalue
- The attribute value (must not be null)locationId
- Identifies the attribtue location.properties
- Attribute propertiespublic void clear()
public void compact()
public int getLength()
getLength
in interface AttributeCollection
getLength
in interface Attributes
public int getNameCode(int index)
getNameCode
in interface AttributeCollection
index
- The position of the attribute in the list.
public int getTypeAnnotation(int index)
getTypeAnnotation
in interface AttributeCollection
index
- The position of the attribute in the list.
NodeInfo.IS_DTD_TYPE
represents a DTD-derived type.public int getLocationId(int index)
getLocationId
in interface AttributeCollection
index
- The position of the attribute in the list.
LocationProvider
in order to obtain the
actual system identifier and line number of the relevant locationpublic String getSystemId(int index)
Attribute location information is not available from a SAX parser, so this method is not useful for getting the location of an attribute in a source document. However, in a Saxon result document, the location information represents the location in the stylesheet of the instruction used to generate this attribute, which is useful for debugging.
getSystemId
in interface AttributeCollection
index
- the required attribute
public int getLineNumber(int index)
Attribute location information is not available from a SAX parser, so this method is not useful for getting the location of an attribute in a source document. However, in a Saxon result document, the location information represents the location in the stylesheet of the instruction used to generate this attribute, which is useful for debugging.
getLineNumber
in interface AttributeCollection
index
- the required attribute
public int getProperties(int index)
getProperties
in interface AttributeCollection
index
- The position of the attribute in the list.
ReceiverOptions
. The
most interesting of these is {ReceiverOptions.DEFAULTED_ATTRIBUTE
,
which indicates an attribute that was added to an element as a result of schema validation.public String getPrefix(int index)
getPrefix
in interface AttributeCollection
index
- The position of the attribute in the list.
public String getQName(int index)
getQName
in interface AttributeCollection
getQName
in interface Attributes
index
- The position of the attribute in the list.
public String getLocalName(int index)
getLocalName
in interface AttributeCollection
getLocalName
in interface Attributes
index
- The position of the attribute in the list.
public String getURI(int index)
getURI
in interface AttributeCollection
getURI
in interface Attributes
index
- The position of the attribute in the list.
public String getType(int index)
getType
in interface Attributes
index
- The position of the attribute in the list.
public String getType(String uri, String localname)
getType
in interface Attributes
uri
- The namespace uri of the attribute.localname
- The local name of the attribute.
public String getValue(int index)
getValue
in interface AttributeCollection
getValue
in interface Attributes
index
- The position of the attribute in the list.
public String getValue(String uri, String localname)
getValue
in interface AttributeCollection
getValue
in interface Attributes
uri
- The namespace uri of the attribute.localname
- The local name of the attribute.
public String getValueByFingerprint(int fingerprint)
getValueByFingerprint
in interface AttributeCollection
public int getIndex(String qname)
getIndex
in interface Attributes
qname
- The lexical QName of the attribute. The prefix must match.
public int getIndex(String uri, String localname)
getIndex
in interface AttributeCollection
getIndex
in interface Attributes
uri
- The namespace uri of the attribute.localname
- The local name of the attribute.
public int getIndexByFingerprint(int fingerprint)
getIndexByFingerprint
in interface AttributeCollection
public String getType(String name)
getType
in interface Attributes
name
- The lexical QName of the attribute.
public String getValue(String name)
getValue
in interface 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 boolean isId(int index)
isId
in interface AttributeCollection
public boolean isIdref(int index)
isIdref
in interface AttributeCollection
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |