A CompositeName represents a name in a naming service which
spans multiple namespaces. For example the name "www.eclipse.org/index.html"
spans the DNS and file system namespaces.
A CompositeName is a series of string elements. A composite
name has a sequence of zero or more elements delimited by the '/' char. Each
element can be accessed using its position. The first element is at position
0.
A CompositeName may be empty. An empty composite name has no
elements. Elements may also be empty.
CompositeName s are read from left to right unlike
CompoundName s which may have their direction of ordering
specified by properties.
Special characters are as follows:
- The separator is /
- The escape character is \
- Quotes can be used - both single quotes and double quotes are allowed.
This allows you to quote strings which contain chars such as / which are part
of a
CompositeName element to avoid them being read as a
separator.
See the examples for further clarification.
Some Examples:
==============
The composite name "www.eclipse.org/index.html" has 2 elements.
"www.eclipse.org" is a name from the DNS namespace. "index.html" is a name
from the file system namespace.
Another example of a composite name is: "www.eclipse.org/org/index.html".
This name has 3 elements "www.eclipse.org", "org" and "index.html".
www.eclipse.org is a name from the DNS namespace. The last 2 elements are
each from the file system namespace.
Some more examples to clarify empty names and elements:
An empty CompositeName is the name "" and has no elements.
A CompositeName with just one empty element is the name "/".
The name "/org/" has 3 elements. The first and last are empty.
The name "/a" has 2 elements. The first element is empty and the second
element is "a".
The name "a//a" has 3 elements. The middle element is empty and the first &
third elements are both "a".
The name "a/'b/a" is invalid as there is no closing quote for the '
character.
The name "a/'a/b/b" is invalid as there is no closing quote for the '
character.
The name "a/\"b/a" is interpreted as a/"b/a and is invalid as there is no
closing quote for the embedded escaped " character.
The name "a/'b/c'/a" has 3 elements. The middle element is b/c.
The name "a/a'a/b'/b" has 4 elements: Element 0 is "a". Element 1 is "a'a".
Element 2 is "b'". Element 3 is "b".
Interestingly the name "a/a'a/b/b" is valid and has 4 elements. This is
because the single quote char ' is not a leading quote and is embedded in an
element so is treated as a character. Element 0 is "a". Element 1 is "a'a".
Element 2 is "b". Element 3 is "b".
The name "\"abcd" gives an InvalidNameException as there is no
closing quote.
The name "'\"abcd'" gives one element of value "abcd.
The name "\\abcd" gives one element of value \abcd.
"" is empty. It has no elements. "/" has one empty element. "//" has 2
empty elements. "/a/" has 3 elements the middle one is set to a. "///" has 3
empty elements. "//a/" has 4 elements, the last but one is set to a.
|