01: package org.geotools.xml.impl;
02:
03: import java.util.Enumeration;
04: import java.util.Iterator;
05:
06: import javax.xml.namespace.NamespaceContext;
07:
08: import org.xml.sax.helpers.NamespaceSupport;
09:
10: /**
11: * NamespaceContext wrapper around namespace support.
12: */
13: public class NamespaceSupportWrapper implements NamespaceContext {
14:
15: NamespaceSupport namespaceSupport;
16:
17: public NamespaceSupportWrapper(NamespaceSupport namesaceSupport) {
18: this .namespaceSupport = namesaceSupport;
19: }
20:
21: public NamespaceSupport getNamespaceSupport() {
22: return namespaceSupport;
23: }
24:
25: public String getNamespaceURI(String prefix) {
26: return namespaceSupport.getURI(prefix);
27: }
28:
29: public String getPrefix(String namespaceURI) {
30: return namespaceSupport.getPrefix(namespaceURI);
31: }
32:
33: public Iterator getPrefixes(String namespaceURI) {
34: final Enumeration e = namespaceSupport
35: .getPrefixes(namespaceURI);
36:
37: return new Iterator() {
38: public void remove() {
39: throw new UnsupportedOperationException();
40: }
41:
42: public boolean hasNext() {
43: return e.hasMoreElements();
44: }
45:
46: public Object next() {
47: return e.nextElement();
48: }
49: };
50: }
51: }
|