1 19 20 package org.netbeans.modules.xml.spi.dom; 21 22 import org.w3c.dom.*; 23 import java.util.*; 24 25 31 public final class NamedNodeMapImpl implements NamedNodeMap { 32 33 private final Map peer; 34 35 36 public static final NamedNodeMap EMPTY = new NamedNodeMapImpl(new HashMap(0)); 37 38 42 public NamedNodeMapImpl(Map peer) { 43 if (peer == null) throw new NullPointerException (); 44 this.peer = peer; 45 } 46 47 public int getLength() { 48 return peer.size(); 49 } 50 51 public org.w3c.dom.Node removeNamedItem(String str) throws org.w3c.dom.DOMException { 52 throw new ROException(); 53 } 54 55 public org.w3c.dom.Node setNamedItemNS(org.w3c.dom.Node node) throws org.w3c.dom.DOMException { 56 throw new ROException(); 57 } 58 59 public org.w3c.dom.Node setNamedItem(org.w3c.dom.Node node) throws org.w3c.dom.DOMException { 60 throw new ROException(); 61 } 62 63 public org.w3c.dom.Node getNamedItemNS(String uri, String local) { 64 return (Node) peer.get(createKey(uri, local)); 65 } 66 67 public org.w3c.dom.Node item(int param) { 68 int i = 0; 69 Iterator it = peer.values().iterator(); 70 while (it.hasNext()) { 71 Object next = it.next(); 72 if (param == i) return (Node) next; 73 i++; 74 } 75 return null; 76 } 77 78 public org.w3c.dom.Node getNamedItem(String str) { 79 return (Node) peer.get(createKey(str)); 80 } 81 82 public org.w3c.dom.Node removeNamedItemNS(String str, String str1) throws org.w3c.dom.DOMException { 83 throw new ROException(); 84 } 85 86 public String toString() { 87 return peer.toString(); 88 } 89 90 93 public static Object createKey(String qname) { 94 return qname; 95 } 96 97 100 public static Object createKey(String uri, String local) { 101 return uri + ":" + local; } 103 104 } 105 | Popular Tags |