net.sf.saxon.tinytree
Class TinyAttributeCollection
java.lang.Object
net.sf.saxon.tinytree.TinyAttributeCollection
- AttributeCollection
public class TinyAttributeCollection
extends java.lang.Object
An implementation of the AttributeCollection interface based directly on the
TinyTree data structure.
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.
|
int | getTypeAnnotation(int index) - Get the type annotation of an attribute (by position).
|
String | getURI(int index) - Get the namespace URI of an attribute (by position).
|
String | getValue(String uri, String localname) - Get the value of an attribute (by name).
|
String | getValue(int index) - Get the value of an attribute (by position).
|
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 | setLocationProvider(LocationProvider provider) - Set the location provider.
|
TinyAttributeCollection
public TinyAttributeCollection(TinyTree tree,
int element)
getIndex
public int getIndex(String uri,
String localname)
Get the index of an attribute (by name).
- getIndex in interface AttributeCollection
uri
- The namespace uri of the attribute.localname
- The local name of the attribute.
- The index position of the attribute
getLength
public int getLength()
Return the number of attributes in the list.
- getLength in interface AttributeCollection
- The number of attributes in the list.
getLineNumber
public 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.
- getLineNumber in interface AttributeCollection
index
- the required attribute
- the line number of the location of the attribute
getLocalName
public String getLocalName(int index)
Get the local name of an attribute (by position).
- getLocalName in interface AttributeCollection
index
- The position of the attribute in the list.
- The local name of the attribute as a string, or null if there
is no attribute at that position.
getLocationId
public int getLocationId(int index)
Get the locationID of an attribute (by position)
- getLocationId in interface AttributeCollection
index
- The position of the attribute in the list.
- 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
getNameCode
public int getNameCode(int index)
Get the namecode of an attribute (by position).
- getNameCode in interface AttributeCollection
index
- The position of the attribute in the list.
- The display name of the attribute as a string, or null if there
is no attribute at that position.
getPrefix
public String getPrefix(int index)
Get the prefix of the name of an attribute (by position).
- getPrefix in interface AttributeCollection
index
- The position of the attribute in the list.
- 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.
getProperties
public int getProperties(int index)
Get the properties of an attribute (by position)
- getProperties in interface AttributeCollection
index
- The position of the attribute in the list.
- 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.
getQName
public String getQName(int index)
Get the lexical QName of an attribute (by position).
- getQName in interface AttributeCollection
index
- The position of the attribute in the list.
- The lexical QName of the attribute as a string, or null if there
is no attribute at that position.
getSystemId
public String getSystemId(int index)
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.
- getSystemId in interface AttributeCollection
index
- the required attribute
- the systemId of the location of the attribute
getTypeAnnotation
public int getTypeAnnotation(int index)
Get the type annotation of an attribute (by position).
- getTypeAnnotation in interface AttributeCollection
index
- The position of the attribute in the list.
- The type annotation of the attribute as the fingerprint of the type name.
The bit
NodeInfo.IS_DTD_TYPE
represents a DTD-derived type.
getURI
public String getURI(int index)
Get the namespace URI of an attribute (by position).
- getURI in interface AttributeCollection
index
- The position of the attribute in the list.
- The local name of the attribute as a string, or null if there
is no attribute at that position.
getValue
public String getValue(String uri,
String localname)
Get the value of an attribute (by name).
- getValue in interface AttributeCollection
uri
- The namespace uri of the attribute.localname
- The local name of the attribute.
- The index position of the attribute
getValue
public String getValue(int index)
Get the value of an attribute (by position).
- getValue in interface AttributeCollection
index
- The position of the attribute in the list.
- The attribute value as a string, or null if
there is no attribute at that position.
isId
public boolean isId(int index)
Determine whether a given attribute has the is-ID property set
- isId in interface AttributeCollection
isIdref
public boolean isIdref(int index)
Determine whether a given attribute has the is-idref property set
- isIdref in interface AttributeCollection
setLocationProvider
public void setLocationProvider(LocationProvider provider)
Set the location provider. This must be set if the methods getSystemId() and getLineNumber()
are to be used to get location information for an attribute.