Package net.sf.saxon.tree.tiny
Class TinyAttributeCollection
- java.lang.Object
-
- net.sf.saxon.tree.tiny.TinyAttributeCollection
-
- All Implemented Interfaces:
AttributeCollection
public class TinyAttributeCollection extends java.lang.Object implements AttributeCollection
An implementation of the AttributeCollection interface based directly on the TinyTree data structure.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) intelement(package private) intfirstAttribute(package private) TinyTreetree
-
Constructor Summary
Constructors Constructor Description TinyAttributeCollection(TinyTree tree, int element)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetIndex(java.lang.String uri, java.lang.String localname)Get the index of an attribute (by name).intgetIndexByFingerprint(int fingerprint)Get the index, given the fingerprintintgetLength()Return the number of attributes in the list.intgetLineNumber(int index)Get the line number part of the location of an attribute, at a given index.java.lang.StringgetLocalName(int index)Get the local name of an attribute (by position).intgetLocationId(int index)Get the locationID of an attribute (by position)intgetNameCode(int index)Get the namecode of an attribute (by position).NodeNamegetNodeName(int index)Get the node name of an attribute (by position)java.lang.StringgetPrefix(int index)Get the prefix of the name of an attribute (by position).intgetProperties(int index)Get the properties of an attribute (by position)java.lang.StringgetQName(int index)Get the lexical QName of an attribute (by position).java.lang.StringgetSystemId(int index)Get the systemId part of the location of an attribute, at a given index.SimpleTypegetTypeAnnotation(int index)Get the type annotation of an attribute (by position).java.lang.StringgetURI(int index)Get the namespace URI of an attribute (by position).java.lang.StringgetValue(int index)Get the value of an attribute (by position).java.lang.StringgetValue(java.lang.String uri, java.lang.String localname)Get the value of an attribute (by name).java.lang.StringgetValueByFingerprint(int fingerprint)Get the attribute value using its fingerprintbooleanisId(int index)Determine whether a given attribute has the is-ID property setbooleanisIdref(int index)Determine whether a given attribute has the is-idref property set
-
-
-
Field Detail
-
element
int element
-
tree
TinyTree tree
-
firstAttribute
int firstAttribute
-
-
Constructor Detail
-
TinyAttributeCollection
public TinyAttributeCollection(TinyTree tree, int element)
-
-
Method Detail
-
getLength
public int getLength()
Return the number of attributes in the list.- Specified by:
getLengthin interfaceAttributeCollection- Returns:
- The number of attributes in the list.
-
getNameCode
public int getNameCode(int index)
Get the namecode of an attribute (by position).- Specified by:
getNameCodein interfaceAttributeCollection- Parameters:
index- The position of the attribute in the list.- Returns:
- The display name of the attribute as a string, or null if there is no attribute at that position.
-
getNodeName
public NodeName getNodeName(int index)
Get the node name of an attribute (by position)- Specified by:
getNodeNamein interfaceAttributeCollection- Parameters:
index- The position of the attribute in the list- Returns:
- The node name of the attribute, or null if there is no attribute in that position
-
getTypeAnnotation
public SimpleType getTypeAnnotation(int index)
Get the type annotation of an attribute (by position).- Specified by:
getTypeAnnotationin interfaceAttributeCollection- Parameters:
index- The position of the attribute in the list.- Returns:
- The type annotation of the attribute
-
getLocationId
public int getLocationId(int index)
Get the locationID of an attribute (by position)- Specified by:
getLocationIdin interfaceAttributeCollection- Parameters:
index- The position of the attribute in the list.- Returns:
- The location identifier of the attribute. This can be supplied
to a
LocationProviderin order to obtain the actual system identifier and line number of the relevant location
-
getSystemId
public java.lang.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.
- Specified by:
getSystemIdin interfaceAttributeCollection- Parameters:
index- the required attribute- Returns:
- the systemId of the location of the attribute
-
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.
- Specified by:
getLineNumberin interfaceAttributeCollection- Parameters:
index- the required attribute- Returns:
- the line number of the location of the attribute
-
getProperties
public int getProperties(int index)
Get the properties of an attribute (by position)- Specified by:
getPropertiesin interfaceAttributeCollection- 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
public java.lang.String getPrefix(int index)
Get the prefix of the name of an attribute (by position).- Specified by:
getPrefixin interfaceAttributeCollection- 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
public java.lang.String getQName(int index)
Get the lexical QName of an attribute (by position).- Specified by:
getQNamein interfaceAttributeCollection- 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
public java.lang.String getLocalName(int index)
Get the local name of an attribute (by position).- Specified by:
getLocalNamein interfaceAttributeCollection- 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
public java.lang.String getURI(int index)
Get the namespace URI of an attribute (by position).- Specified by:
getURIin interfaceAttributeCollection- 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
public int getIndex(java.lang.String uri, java.lang.String localname)Get the index of an attribute (by name).- Specified by:
getIndexin interfaceAttributeCollection- Parameters:
uri- The namespace uri of the attribute.localname- The local name of the attribute.- Returns:
- The index position of the attribute, or -1 if there is no attribute with this name
-
getIndexByFingerprint
public int getIndexByFingerprint(int fingerprint)
Get the index, given the fingerprint- Specified by:
getIndexByFingerprintin interfaceAttributeCollection- Parameters:
fingerprint- the NamePool fingerprint of the required attribute name- Returns:
- The index position of the attribute, or -1 if there is no attribute with this name
-
getValueByFingerprint
public java.lang.String getValueByFingerprint(int fingerprint)
Get the attribute value using its fingerprint- Specified by:
getValueByFingerprintin interfaceAttributeCollection
-
getValue
public java.lang.String getValue(java.lang.String uri, java.lang.String localname)Get the value of an attribute (by name).- Specified by:
getValuein interfaceAttributeCollection- Parameters:
uri- The namespace uri of the attribute.localname- The local name of the attribute.- Returns:
- The index position of the attribute
-
getValue
public java.lang.String getValue(int index)
Get the value of an attribute (by position).- Specified by:
getValuein interfaceAttributeCollection- 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
public boolean isId(int index)
Determine whether a given attribute has the is-ID property set- Specified by:
isIdin interfaceAttributeCollection
-
isIdref
public boolean isIdref(int index)
Determine whether a given attribute has the is-idref property set- Specified by:
isIdrefin interfaceAttributeCollection
-
-