Begin the scope of a prefix-URI Namespace mapping.

The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default).

There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/end_prefix_mapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary.

Note that start/end_prefix_mapping events are not guaranteed to be properly nested relative to each other: all start/end_prefix_mapping events will occur immediately before the corresponding start_element event, and all end_prefix_mapping events will occur immediately after the corresponding end_element event, but their order is not otherwise guaranteed.

There should never be start/end_prefix_mapping events for the xml prefix, since it is predeclared and immutable.

Parameters:

  • prefix: Namespace prefix being declared. An empty string is used for the default element namespace, which has no prefix.
  • uri: Namespace URI the prefix is mapped to.

SEE: end_prefix_mapping SEE: start_element

Property definitions

sax $ ContentHandler :: start_prefix_mapping
	# Begin the scope of a prefix-URI Namespace mapping.
	#
	# The information from this event is not necessary for
	# normal Namespace processing: the SAX XML reader will
	# automatically replace prefixes for element and attribute
	# names when the `http://xml.org/sax/features/namespaces`
	# feature is `true` (the default).
	#
	# There are cases, however, when applications need to
	# use prefixes in character data or in attribute values,
	# where they cannot safely be expanded automatically; the
	# `start/end_prefix_mapping` event supplies the information
	# to the application to expand prefixes in those contexts
	# itself, if necessary.
	#
	# Note that `start/end_prefix_mapping` events are not
	# guaranteed to be properly nested relative to each other:
	# all `start/end_prefix_mapping` events will occur immediately before the
	# corresponding `start_element` event,
	# and all `end_prefix_mapping`
	# events will occur immediately after the corresponding
	# `end_element` event, but their order is not otherwise
	# guaranteed.
	#
	# There should never be `start/end_prefix_mapping` events for the
	# `xml` prefix, since it is predeclared and immutable.
	#
	# Parameters:
	#
	# * `prefix`: Namespace prefix being declared.
	#An empty string is used for the default element namespace,
	#which has no prefix.
	# * `uri`: Namespace URI the prefix is mapped to.
	#
	# SEE: `end_prefix_mapping`
	# SEE: `start_element`
	fun start_prefix_mapping(prefix: String, uri: String) do end
lib/sax/content_handler.nit:92,2--128,61

sax $ XMLFilterImpl :: start_prefix_mapping
	redef fun start_prefix_mapping(prefix, uri) do
		if content_handler != null then
			content_handler.start_prefix_mapping(prefix, uri)
		end
	end
lib/sax/helpers/xml_filter_impl.nit:276,2--280,4

saxophonit $ SAXEventLogger :: start_prefix_mapping
	redef fun start_prefix_mapping(prefix, uri) do
		log.push(["start_prefix_mapping", prefix, uri])
		super
	end
lib/saxophonit/testing.nit:360,2--363,4