Assigns the specified XML namespace binding to the specified element.

The effect of this function will be that as if the namespace binding was actually specified in the original XML element (associated with the GOMElement provided in the parameter), like this:

<element xmlns:prefix="namespaceURI" ... >
  ...
</element>
That will be called adopted namespace binding. However, it is not quite the same as the normal one:
  1. To avoid any collisions, a new namespace binding may be adopted only by an element that has no other binding for the same prefix originally specified in it.
  2. The adopted namespace binding will not affect the names of any XML document's elements or attributes within its scope.

    For instance, when element with unqualified name adopts a new binding for the default namespace, the element's name will remain in its original namespace (which was the default one before adopting the binding).

The adopted namespace binging will be used for resolving any qualified name values (that is of xs:QName type) found within its scope.

For instance, when the following XSD declaration falls within the adopted binding's scope:

<xs:element name="SomeName" type="SomeType">
the qualified name 'SomeType' will be resolved including against that binding too.

Note:

When the binding is successfully assigned, a #NAMESPACE pseudo-element representing it will be created (or updated). The 'original' attribute of that element will be set false to indicates that this namespace binding is adopted (not found in the original XML document).

Parameters:

element

Specify the context element where the new namespace binding is to be adopted.

If the specified GOMElement element represents some actual XML element, the binding will be assigned exactly to it.

When this is a pseudo-element associated with some non-element XML DOM node, the binding will be assigned to the nearest XML element ancestor of that node.

prefix
Specify the namespace binding's prefix.

An empty string will indicate the default namespace binding.

namespaceURI
Specify the namespace URI.

An empty string will specify "no namespace".

Returns:

true - the binding has been successfully assigned;
false - the binding cannot be assigned (e.g. the passed context element is not associated with any XML DOM node, or it has no XML element ancestor, or the XML element already has an original binding for the same prefix)

See Also:

All Element Types | #NAMESPACE