getOrCreatePrefix
Helper function to ensure a namespace is bound to a prefix. Returns either an existing prefix or a newly allocated (unique) one.
The algorithm works as follows:
If the prefixHint is given and it is bound to the given namespaceUri use that.
If the namespaceUri is already bound to a prefix use that.
If the namespaceUri is empty, write a new namespace attribute for the empty prefix to be bound to the empty namespace.
If the prefixHint is given and it is not bound to a namespace, write a new namespace attribute for the prefixHint and the namespaceUri.
Otherwise generate prefixes starting with "ns1". Find the first one not bound to a namespace, write a new namespace attribute for that prefix and the namespaceUri.
Return
The prefix to use
Parameters
The namespace uri to ensure a prefix for
A hint for the prefix to use. If null no hint is given.
If true, the name is for use as attribute, and thus the blank namespace is reserved for blank prefixes.
