Adapts the specified QName (the detailed representation of an XML name; see below) to the specified XML document context(s).
In particular, this function returns a new QName object whose
QName.namespaceURI
and QName.localName
properties are copied from the specified QName object.
However, the value of QName.prefix
property is resolved anew
from the given namespace URI according to one or many XML document contexts
specified with contextElement
or contextElements
parameter.
If neither of the provided contexts defines bindings for such an URI or
the found new prefix is the same as the old one, the original qName
is returned.
This function may be useful, when you need to show in an output document the qualified name of a certain global XML name (which may originate itself from a different context, not exactly related to this document), so as it will look accordingly to the namespace prefix conventions used in this particular document.
Parameters:
qName
Note: When this parameter is null
, so returns the function.
contextElement
QName.prefix
property is to be resolved.
contextElements
The function starts from the first element and uses it to resolve the new value of
QName.prefix
property.
If the element's context does not define the necessary namespace URI/prefix binding, the function tries the next element from the enumeration and repeats so until the binding found or the last element reached.
contextElement
nor contextElements
parameter is specified, the generator context element will be used by default.
Returns:
QName
object with the new namespace prefix
or the original qName
, if no namespace binding found or
the new prefix is equal to the old one.
makeQualifiedName()