Class Summary : TBufferedAttributesImpl
Default implementation of the IBufferedAttributes interface.
This module, both source code and documentation, is in the
Public Domain, and comes with NO WARRANTY.
This class provides a default implementation of the SAX2
IBufferedAttributes interface, with the
addition of manipulators so that the list can be modified or
reused.
There are two typical uses of this class:
- to take a persistent snapshot of an Attributes object
in a startElement event; or
- to construct or modify an IAttributes object in a SAX2 driver or filter.
This class replaces the now-deprecated SAX1 AttributeListImpl
class; in addition to supporting the updated Attributes
interface rather than the deprecated IAttributeList
interface, it also includes a much more efficient
implementation using a single array rather than a set of Vectors.
Since : SAX 2.0
Methods
procedure
ensureCapacity(Integer)
procedure
badIndex(Integer)
function
getLength() : Integer
procedure
getURI(Integer, PSAXChar, Integer)
procedure
getLocalName(Integer, PSAXChar, Integer)
procedure
getQName(Integer, PSAXChar, Integer)
procedure
getType(Integer, PSAXChar, Integer)
procedure
getType(PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer)
procedure
getType(PSAXChar, Integer, PSAXChar, Integer)
procedure
getValue(Integer, PSAXChar, Integer)
procedure
getValue(PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer)
procedure
getValue(PSAXChar, Integer, PSAXChar, Integer)
function
getIndex(PSAXChar, Integer, PSAXChar, Integer) : Integer
function
getIndex(PSAXChar, Integer) : Integer
procedure
clear()
procedure
setAttributes(IBufferedAttributes)
procedure
addAttribute(PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer)
procedure
setAttribute(Integer, PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer)
procedure
removeAttribute(Integer)
procedure
setURI(Integer, PSAXChar, Integer)
procedure
setLocalName(Integer, PSAXChar, Integer)
procedure
setQName(Integer, PSAXChar, Integer)
procedure
setType(Integer, PSAXChar, Integer)
procedure
setValue(Integer, PSAXChar, Integer)
procedure ensureCapacity( n : Integer);
Ensure the internal array's capacity.
Parameter : n The minimum number of attributes that the array must
be able to hold.
Top
procedure badIndex( index : Integer);
Report a bad array index in a manipulator.
Parameter : index The index to report.
Exception : Exception Always.
Top
function getLength() : Integer;
Return the number of attributes in the list.
Result : The number of attributes in the list.
See : IBufferedAttributes.getLength
Top
procedure getURI( index : Integer; uri : PSAXChar; uriLength : Integer);
Return an attribute's Namespace URI.
Parameter : index The attribute index (zero-based).
Parameter : uri The Namespace URI, or the empty string if none
is available or if the index is out of range.
Parameter : uriLength The length of the Namespace URI buffer.
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
See : IBufferedAttributes.getURI
Top
procedure getLocalName( index : Integer; localName : PSAXChar; localNameLength : Integer);
Return an attribute's local name.
Parameter : index The attribute index (zero-based).
Parameter : localName The local name, or the empty string if Namespace
processing is not being performed or if the
index is out of range.
Parameter : localNameLength The length of the localName buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
See : IBufferedAttributes.getLocalName
Top
procedure getQName( index : Integer; qName : PSAXChar; qNameLength : Integer);
Return an attribute's qualified (prefixed) name.
Parameter : index The attribute index (zero-based).
Parameter : qName The XML 1.0 qualified name, or the empty string
if none is available or if the index is out of
range.
Parameter : qNameLength The length of the qName buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
See : IBufferedAttributes.getQName
Top
procedure getType( index : Integer; attrType : PSAXChar; attrTypeLength : Integer);
Return an attribute's type by index.
Parameter : index The attribute index (zero-based).
Parameter : attrType The attribute's type as a string or an empty string if the
index is out of range.
Parameter : attrTypeLength The length of the attrType buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
See : IBufferedAttributes.getType(Integer,PSAXChar,Integer)
Top
procedure getType( uri : PSAXChar; uriLength : Integer; localName : PSAXChar; localNameLength : Integer; attrType : PSAXChar; attrTypeLength : Integer);
Look up an attribute's type by Namespace-qualified name.
Parameter : uri The Namespace uri
Parameter : uriLength The length of the uri Buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Parameter : localName The XML 1.0 local name
Parameter : localNameLength The length of the localName buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Parameter : uri The Namespace uri
Parameter : attrType The attribute's type as a string or an empty string if the
attribute is not in the list
Parameter : attrTypeLength The length of the attrType buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
See : IBufferedAttributes.getType(PSAXChar,Integer,PSAXChar,Integer,PSAXChar,Integer)
Top
procedure getType( qName : PSAXChar; qNameLength : Integer; attrType : PSAXChar; attrTypeLength : Integer);
Look up an attribute's type by qualified (prefixed) name.
Parameter : qName The XML 1.0 qualified name.
Parameter : qNameLength The length of the qName buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Parameter : attrType The attribute type as a string, or an empty string if the
attribute is not in the list or if qualified names
are not available.
Parameter : attrTypeLength The length of the attrType buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
See : IBufferedAttributes.getType(PSAXChar,Integer,PSAXChar,Integer)
Top
procedure getValue( index : Integer; value : PSAXChar; valueLength : Integer);
Return an attribute's value by index.
Parameter : index The attribute index (zero-based).
Parameter : value The attribute's value as a string, or an empty string if the
index is out of range.
Parameter : valueLength The length of the value buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
See : IBufferedAttributes.getValue(Integer,PSAXChar,Integer)
Top
procedure getValue( uri : PSAXChar; uriLength : Integer; localName : PSAXChar; localNameLength : Integer; value : PSAXChar; valueLength : Integer);
Look up an attribute's value by Namespace-qualified name.
Parameter : uri The Namespace URI, or the empty String if the
name has no Namespace URI.
Parameter : uriLength The length of the uri buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Parameter : localName The local name of the attribute.
Parameter : localNameLength The length of the localName buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Parameter : value The attribute value as a string, or an empty string if the
attribute is not in the list.
Parameter : valueLength The length of the value buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
See : IBufferedAttributes.getValue(PSAXChar,Integer,PSAXChar,Integer)
Top
procedure getValue( qName : PSAXChar; qNameLength : Integer; value : PSAXChar; valueLength : Integer);
Look up an attribute's value by qualified (prefixed) name.
Parameter : qName The qualified (prefixed) name.
Parameter : qNameLength The length of the qName buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Parameter : value The attribute value as a string, or an empty string if the
attribute is not in the list.
Parameter : valueLength The length of the value buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
See : IBufferedAttributes.getValue(PSAXChar,Integer,PSAXChar,Integer)
Top
function getIndex( uri : PSAXChar; uriLength : Integer; localName : PSAXChar; localNameLength : Integer) : Integer;
Look up an attribute's index by Namespace name.
In many cases, it will be more efficient to look up the name once and
use the index query methods rather than using the name query methods
repeatedly.
Parameter : uri The Namespace URI, or the empty string if
the name has no Namespace URI.
Parameter : uriLength The length of the uri buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Parameter : localName The attribute's local name.
Parameter : loclaNameLength The length of the localName buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Result : The index of the attribute, or -1 if it does not
appear in the list.
See : IBufferedAttributes.getIndex(PSAXChar,Integer,PSAXChar,Integer)
Top
function getIndex( qName : PSAXChar; qNameLength : Integer) : Integer;
Look up an attribute's index by qualified (prefixed) name.
Parameter : qName The qualified (prefixed) name.
Parameter : qNameLength The length of the qName buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Result : The index of the attribute, or -1 if it does not
appear in the list.
See : IBufferedAttributes.getIndex(PSAXChar,Integer)
Top
procedure clear();
Clear the attribute list for reuse.
Note that little memory is freed by this call:
the current array is kept so it can be
reused.
Top
procedure setAttributes(const atts : IBufferedAttributes);
Copy an entire Attributes object.
It may be more efficient to reuse an existing object
rather than constantly allocating new ones.
Parameter : atts The attributes to copy.
Top
procedure addAttribute( uri : PSAXChar; uriLength : Integer; localName : PSAXChar; localNameLength : Integer; qName : PSAXChar; qNameLength : Integer; attrType : PSAXChar; attrTypeLength : Integer; value : PSAXChar; valueLength : Integer);
Add an attribute to the end of the list.
For the sake of speed, this method does no checking
to see if the attribute is already in the list: that is
the responsibility of the application.
Parameter : uri The Namespace URI, or the empty string if
none is available or Namespace processing is not
being performed.
Parameter : uriLength The length of the uri buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Parameter : localName The local name, or the empty string if
Namespace processing is not being performed.
Parameter : localNameLength The length of the localName buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Parameter : qName The qualified (prefixed) name, or the empty string
if qualified names are not available.
Parameter : qNameLength The length of the qName buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Parameter : attrType The attribute type as a string.
Parameter : attrTypeLength The length of the attrType buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Parameter : value The attribute value.
Parameter : valueLength The length of the value buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Top
procedure setAttribute( index : Integer; uri : PSAXChar; uriLength : Integer; localName : PSAXChar; localNameLength : Integer; qName : PSAXChar; qNameLength : Integer; attrType : PSAXChar; attrTypeLength : Integer; value : PSAXChar; valueLength : Integer);
Set an attribute in the list.
For the sake of speed, this method does no checking
for name conflicts or well-formedness: such checks are the
responsibility of the application.
Parameter : index The index of the attribute (zero-based).
Parameter : uri The Namespace URI, or the empty string if
none is available or Namespace processing is not
being performed.
Parameter : uriLength The length of the uri buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Parameter : localName The local name, or the empty string if
Namespace processing is not being performed.
Parameter : localNameLength The length of the localName buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Parameter : qName The qualified name, or the empty string
if qualified names are not available.
Parameter : qNameLength The length of the qName buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Parameter : attrType The attribute type as a string.
Parameter : attrTypeLength The length of the attrType buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Parameter : value The attribute value.
Parameter : valueLength The length of the value buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Exception : Exception when the supplied index does not
point to an attribute in the list.
Top
procedure removeAttribute( index : Integer);
Remove an attribute from the list.
Parameter : index The index of the attribute (zero-based).
Exception : Exception when the supplied index does not
point to an attribute in the list.
Top
procedure setURI( index : Integer; uri : PSAXChar; uriLength : Integer);
Set the Namespace URI of a specific attribute.
Parameter : index The index of the attribute (zero-based).
Parameter : uri The attribute's Namespace URI, or the empty
string for none.
Parameter : uriLength The length of the uri buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Exception : Exception when the supplied index does not
point to an attribute in the list.
Top
procedure setLocalName( index : Integer; localName : PSAXChar; localNameLength : Integer);
Set the local name of a specific attribute.
Parameter : index The index of the attribute (zero-based).
Parameter : localName The attribute's local name, or the empty
string for none.
Parameter : localNameLength The length of the localName buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Exception : Exception when the supplied index does not
point to an attribute in the list.
Top
procedure setQName( index : Integer; qName : PSAXChar; qNameLength : Integer);
Set the qualified name of a specific attribute.
Parameter : index The index of the attribute (zero-based).
Parameter : qName The attribute's qualified name, or the empty
string for none.
Parameter : qNameLength The length of the qName buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Exception : Exception when the supplied index does not
point to an attribute in the list.
Top
procedure setType( index : Integer; attrType : PSAXChar; attrTypeLength : Integer);
Set the type of a specific attribute.
Parameter : index The index of the attribute (zero-based).
Parameter : attrType The attribute's type.
Parameter : attrTypeLength The length of the attrType buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Exception : Exception when the supplied index does not
point to an attribute in the list.
Top
procedure setValue( index : Integer; value : PSAXChar; valueLength : Integer);
Set the value of a specific attribute.
Parameter : index The index of the attribute (zero-based).
Parameter : value The attribute's value.
Parameter : valueLength The length of the value buffer
The value may be -1 which indicates that the buffer is
null-terminated. If the value is 0 then the buffer may be nil.
Exception : Exception when the supplied index does not
point to an attribute in the list.
Top