Look up the index of an attribute by Namespace name.

Parameters:

  • uri: Namespace URI, or the empty string if the name has no Namespace URI.
  • local_name: attribute's local name.

Returns:

The index of the attribute, or -1 if it does not appear in the list.

Property definitions

sax $ Attributes :: index_ns
	# Look up the index of an attribute by Namespace name.
	#
	# Parameters:
	#
	# * `uri`: Namespace URI, or the empty string if
	# the name has no Namespace URI.
	# * `local_name`: attribute's local name.
	#
	# Returns:
	#
	# The index of the attribute, or -1 if it does not
	# appear in the list.
	fun index_ns(uri: String, local_name: String): Int is abstract
lib/sax/attributes.nit:147,2--159,63

sax $ AttributesImpl :: index_ns
	# Look up the index of an attribute by Namespace 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.
	#
	# Parameters:
	#
	# * `uri`: Namespace URI, or the empty string if
	# the name has no Namespace URI.
	# * `local_name`: attribute's local name.
	#
	# Returns:
	#
	# The index of the attribute, or -1 if it does not
	# appear in the list.
	redef fun index_ns(uri, local_name) do
		var i = 0

		if "" != local_name then
			while i < data.length do
				if data[i] == uri and data[i + 1] == local_name then
					return i / 5
				end
				i += 5
			end
		end
		return -1
	end
lib/sax/helpers/attributes_impl.nit:145,2--172,4