An XML Namespace has the properties:
XMLConstants.XMLNS_ATTRIBUTE
("xmlns") in the Namespace declarationexample:
<element xmlns:prefix="http://Namespace-name-URI">
All get*(*) methods operate in the current scope
for Namespace URI and prefix resolution.
Note that a Namespace URI can be bound to
multiple prefixes in the current scope. This can
occur when multiple XMLConstants.XMLNS_ATTRIBUTE
("xmlns") Namespace declarations occur in the same Start-Tag and
refer to the same Namespace URI. e.g.
<element xmlns:prefix1="http://Namespace-name-URI"
xmlns:prefix2="http://Namespace-name-URI">
This can also occur when the same Namespace URI is used in multiple
XMLConstants.XMLNS_ATTRIBUTE ("xmlns") Namespace
declarations in the logical parent element hierarchy. e.g. <parent xmlns:prefix1="http://Namespace-name-URI">
<child xmlns:prefix2="http://Namespace-name-URI">
...
</child>
</parent>
A prefix can only be bound to a single Namespace URI in the current scope.
javax.xml.XMLConstants for declarations of common XML values , XML Schema Part2: Datatypes, Namespaces in XML
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: Namespace URI bound to prefix in the current scopeprefix to look up prefix)Get Namespace URI bound to a prefix in the current scope. |
| public String | |
| public Iterator | Returns: Iterator for all prefixes bound to the
Namespace URI in the current scopeURI of Namespace to lookup namespaceURI)Get all prefixes bound to a Namespace URI in the current scope. |
| getNamespaceURI | back to summary | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| public String getNamespaceURI(String prefix) Get Namespace URI bound to a prefix in the current scope. When requesting a Namespace URI by prefix, the following table describes the returned Namespace URI value for all possible prefix values:
| |||||||||||||||
| getPrefix | back to summary | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| public String getPrefix(String namespaceURI) Get prefix bound to Namespace URI in the current scope. To get all prefixes bound to a Namespace URI in the current
scope, use When requesting a prefix by Namespace URI, the following table describes the returned prefix value for all Namespace URI values:
| |||||||||||||||
| getPrefixes | back to summary | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| public Iterator Get all prefixes bound to a Namespace URI in the current scope. An Iterator over String elements is returned in an arbitrary, implementation dependent, order. The When requesting prefixes by Namespace URI, the following table describes the returned prefixes value for all Namespace URI values:
| |||||||||||||