Package net.sf.saxon.om
Interface AttributeCollection
- All Known Implementing Classes:
AttributeCollectionImpl
,TinyAttributeCollection
public interface AttributeCollection
AttributeCollection represents the collection of attributes available on a particular element
node. It is modelled on the SAX2 Attributes interface, but is extended firstly to work with
Saxon NamePools, and secondly to provide type information as required by the XPath 2.0 data model.
-
Method Summary
Modifier and TypeMethodDescriptionint
Get the index of an attribute (by name).int
getIndexByFingerprint
(int fingerprint) Get the index, given the fingerprintint
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.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).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)getQName
(int index) Get the lexical QName of an attribute (by position).getSystemId
(int index) Get the systemId part of the location of an attribute, at a given index.int
getTypeAnnotation
(int index) Get the type annotation of an attribute (by position).getURI
(int index) Get the namespace URI of an attribute (by position).getValue
(int index) Get the value of an attribute (by position).Get the value of an attribute (by name).getValueByFingerprint
(int fingerprint) Get the attribute value using its fingerprintboolean
isId
(int index) Determine whether a given attribute has the is-ID property setboolean
isIdref
(int index) Determine whether a given attribute has the is-idref property set
-
Method Details
-
getLength
int getLength()Return the number of attributes in the list.- Returns:
- The number of attributes in the list.
-
getNameCode
int getNameCode(int index) Get the namecode of an attribute (by position).- Parameters:
index
- The position of the attribute in the list.- Returns:
- The name code of the attribute, or -1 if there is no attribute at that position.
-
getTypeAnnotation
int getTypeAnnotation(int index) Get the type annotation of an attribute (by position).- Parameters:
index
- The position of the attribute in the list.- Returns:
- The type annotation, as the fingerprint of the type name.
The bit
NodeInfo.IS_DTD_TYPE
represents a DTD-derived type.
-
getLocationId
int getLocationId(int index) Get the locationID of an attribute (by position)- Parameters:
index
- The position of the attribute in the list.- Returns:
- The location identifier of the attribute. This can be supplied
to a
LocationProvider
in order to obtain the actual system identifier and line number of the relevant location
-
getSystemId
Get the systemId part of the location of an attribute, at a given 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.
- Parameters:
index
- the required attribute- Returns:
- the systemId of the location of the attribute
-
getLineNumber
int getLineNumber(int index) Get the line number part of the location of an attribute, at a given 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.
- Parameters:
index
- the required attribute- Returns:
- the line number of the location of the attribute
-
getProperties
int getProperties(int index) Get the properties of an attribute (by position)- Parameters:
index
- The position of the attribute in the list.- Returns:
- The properties of the attribute. This is a set
of bit-settings defined in class
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.
-
getPrefix
Get the prefix of the name of an attribute (by position).- Parameters:
index
- The position of the attribute in the list.- Returns:
- The prefix of the attribute name as a string, or null if there is no attribute at that position. Returns "" for an attribute that has no prefix.
-
getQName
Get the lexical QName of an attribute (by position).- Parameters:
index
- The position of the attribute in the list.- Returns:
- The lexical QName of the attribute as a string, or null if there is no attribute at that position.
-
getLocalName
Get the local name of an attribute (by position).- Parameters:
index
- The position of the attribute in the list.- Returns:
- The local name of the attribute as a string, or null if there is no attribute at that position.
-
getURI
Get the namespace URI of an attribute (by position).- Parameters:
index
- The position of the attribute in the list.- Returns:
- The local name of the attribute as a string, or null if there is no attribute at that position.
-
getIndex
Get the index of an attribute (by name).- Parameters:
uri
- The namespace uri of the attribute.localname
- The local name of the attribute.- Returns:
- The index position of the attribute
-
getIndexByFingerprint
int getIndexByFingerprint(int fingerprint) Get the index, given the fingerprint -
getValueByFingerprint
Get the attribute value using its fingerprint -
getValue
Get the value of an attribute (by name).- Parameters:
uri
- The namespace uri of the attribute.localname
- The local name of the attribute.- Returns:
- The index position of the attribute
-
getValue
Get the value of an attribute (by position).- Parameters:
index
- The position of the attribute in the list.- Returns:
- The attribute value as a string, or null if there is no attribute at that position.
-
isId
boolean isId(int index) Determine whether a given attribute has the is-ID property set -
isIdref
boolean isIdref(int index) Determine whether a given attribute has the is-idref property set
-