Look up an attribute's type by index.

The attribute type is one of the strings CDATA, ID, IDREF, IDREFS, NMTOKEN, NMTOKENS, ENTITY, ENTITIES, or NOTATION (always in upper case).

If the parser has not read a declaration for the attribute, or if the parser does not report attribute types, then it must return the value CDATA as stated in the XML 1.0 Recommentation (clause 3.3.3, "Attribute-Value Normalization").

For an enumerated attribute that is not a notation, the parser will report the type as NMTOKEN.

Parameters:

  • index: Int: attribute index.
  • index: String: XML 1.0 qualified (prefixed) name.

Returns:

The attribute's type as a string, or null if the specified attribute is not in the list or if qualified names are not available.

SEE: length

Property definitions

sax $ Attributes :: type_of
	# Look up an attribute's type by index.
	#
	# The attribute type is one of the strings `CDATA`, `ID`,
	# `IDREF`, `IDREFS`, `NMTOKEN`, `NMTOKENS`, `ENTITY`, `ENTITIES`,
	# or `NOTATION` (always in upper case).
	#
	# If the parser has not read a declaration for the attribute,
	# or if the parser does not report attribute types, then it must
	# return the value `CDATA` as stated in the XML 1.0 Recommentation
	# (clause 3.3.3, "Attribute-Value Normalization").
	#
	# For an enumerated attribute that is not a notation, the
	# parser will report the type as `NMTOKEN`.
	#
	# Parameters:
	#
	# * `index: Int`: attribute index.
	# * `index: String`: XML 1.0 qualified (prefixed) name.
	#
	# Returns:
	#
	# The attribute's type as a string, or `null` if the specified
	# attribute is not in the list or if qualified names
	# are not available.
	#
	# SEE: `length`
	fun type_of(index: Object): nullable String is abstract
lib/sax/attributes.nit:98,2--124,56

sax $ AttributesImpl :: type_of
	# Look up an attribute's type by index.
	#
	# The attribute type is one of the strings `CDATA`, `ID`,
	# `IDREF`, `IDREFS`, `NMTOKEN`, `NMTOKENS`, `ENTITY`, `ENTITIES`,
	# or `NOTATION` (always in upper case).
	#
	# If the parser has not read a declaration for the attribute,
	# or if the parser does not report attribute types, then it must
	# return the value `CDATA` as stated in the XML 1.0 Recommentation
	# (clause 3.3.3, "Attribute-Value Normalization").
	#
	# For an enumerated attribute that is not a notation, the
	# parser will report the type as `NMTOKEN`.
	#
	# 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 type 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 type_of(index) do
		if index isa Int then
			if index >= 0 and index < length then
				return data[index * 5 + 3]
			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 + 3]
				end
				i += 5
			end
		end
		return null
	end
lib/sax/helpers/attributes_impl.nit:60,2--104,4