1 56 57 package org.jdom.contrib.ids; 58 59 import java.util.*; 60 61 import org.jdom.Document; 62 import org.jdom.DocType; 63 import org.jdom.Element; 64 65 66 85 public class IdDocument extends Document { 86 87 90 private Map ids = new HashMap(); 91 92 101 public IdDocument(Element root, DocType docType) { 102 super(root, docType); 103 } 104 105 114 public IdDocument(Element root) { 115 super(root); 116 } 117 118 128 public Element getElementById(String id) { 129 return ((Element)(ids.get(id))); 130 } 131 132 140 protected void addId(String id, Element elt) { 141 ids.put(id, elt); 142 return; 143 } 144 145 154 protected boolean removeId(String id) { 155 return (ids.remove(id) != null); 156 } 157 } 158 159 | Popular Tags |