sax :: NamespaceSupport :: process_name
declare_prefix
.This method processes a raw XML qualified name in the current context by removing the prefix and looking it up among the prefixes currently declared. The return value will be the array supplied by the caller, filled in as follows:
parts[0]
: Namespace URI, or an empty string if none is in use.parts[1]
: local name (without prefix).parts[2]
: original raw name.If the raw name has a prefix that has not been declared, then
the return value will be null
.
Note that attribute names are processed differently than element names: an unprefixed element name will receive the default Namespace (if any), while an unprefixed attribute name will not.
Parameters:
qname
: raw XML qualified name to be processed.parts
: array supplied by the caller. Will be enlarged to 3 elements if
needed. If the specified array contains more than 3 elements, its length
will be kept intact.is_attribute
: flag indicating whether this is an attribute name
(true
) or an element name (false
).SEE: declare_prefix
# Process a raw XML qualified name, after all declarations in the current context have been handled by `declare_prefix`.
#
# This method processes a raw XML qualified name in the current
# context by removing the prefix and looking it up among the
# prefixes currently declared. The return value will be the
# array supplied by the caller, filled in as follows:
#
# * `parts[0]`: Namespace URI, or an empty string if none is in use.
# * `parts[1]`: local name (without prefix).
# * `parts[2]`: original raw name.
#
# If the raw name has a prefix that has not been declared, then
# the return value will be `null`.
#
# Note that attribute names are processed differently than
# element names: an unprefixed element name will receive the
# default Namespace (if any), while an unprefixed attribute name
# will not.
#
# Parameters:
#
# * `qname`: raw XML qualified name to be processed.
# * `parts`: array supplied by the caller. Will be enlarged to 3 elements if
# needed. If the specified array contains more than 3 elements, its length
# will be kept intact.
# * `is_attribute`: flag indicating whether this is an attribute name
# (`true`) or an element name (`false`).
#
# SEE: `declare_prefix`
fun process_name(qname: String, parts: Array[String], is_attribute: Bool):
nullable Array[String] do
var my_parts = current_context.process_name(qname, is_attribute)
if my_parts == null then
return null
else
parts[0] = my_parts[0]
parts[1] = my_parts[1]
parts[2] = my_parts[2]
if parts[0] == "" and qname == "xmlns" and is_attribute then
parts[0] = nsdecl
parts[1] = ""
end
return parts
end
end
lib/sax/helpers/namespace_support.nit:229,2--274,4