If the attribute value is a list of tokens (IDREFS
,
ENTITIES
, or NMTOKENS
), the tokens will be concatenated
into a single string with each token separated by a
single space.
Parameters:
index: Int
: attribute index.index: String
: XML 1.0 qualified (prefixed) name.Returns:
The attribute's value as a string, or null
if the specified
attribute is not in the list or if qualified names
are not available.
SEE: length
# Look up an attribute's value by index.
#
# If the attribute value is a list of tokens (`IDREFS`,
# `ENTITIES`, or `NMTOKENS`), the tokens will be concatenated
# into a single string with each token separated by a
# single space.
#
# Parameters:
#
# * `index: Int`: attribute index.
# * `index: String`: XML 1.0 qualified (prefixed) name.
#
# Returns:
#
# The attribute's value as a string, or `null` if the specified
# attribute is not in the list or if qualified names
# are not available.
#
# SEE: `length`
fun value_of(index: Object): nullable String is abstract
lib/sax/attributes.nit:126,2--145,57
# Look up an attribute's value by index.
#
# If the attribute value is a list of tokens (`IDREFS`,
# `ENTITIES`, or `NMTOKENS`), the tokens will be concatenated
# into a single string with each token separated by a
# single space.
#
# Parameters:
#
# * `index: Int`: attribute index.
# * `index: String`: XML 1.0 qualified (prefixed) name.
# In many cases, it will be more efficient to look up the name once and
# query by `Int` index rather than quering by name repeatedly.
#
# Returns:
#
# The attribute's value as a string, or `null` if the specified
# attribute is not in the list or if qualified names
# are not available.
#
# SEE: `length`
redef fun value_of(index) do
if index isa Int then
if index >= 0 and index < length then
return data[index * 5 + 4]
end
else if index isa String and "" != index then
var i = 0
while i < data.length do
if data[i + 2] == index then
return data[i + 4]
end
i += 5
end
end
return null
end
lib/sax/helpers/attributes_impl.nit:106,2--143,4