1 6 7 10 11 package javax.xml.transform.dom; 12 13 import javax.xml.transform.Result ; 14 import org.w3c.dom.Node ; 15 16 25 public class DOMResult implements Result { 26 27 31 public static final String FEATURE = "http://javax.xml.transform.dom.DOMResult/feature"; 32 33 41 public DOMResult() { 42 setNode(null); 43 setNextSibling(null); 44 setSystemId(null); 45 } 46 47 62 public DOMResult(Node node) { 63 setNode(node); 64 setNextSibling(null); 65 setSystemId(null); 66 } 67 68 82 public DOMResult(Node node, String systemId) { 83 setNode(node); 84 setNextSibling(null); 85 setSystemId(systemId); 86 } 87 88 117 public DOMResult(Node node, Node nextSibling) { 118 119 if (nextSibling != null) { 121 if (node == null) { 123 throw new IllegalArgumentException ("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node."); 124 } 125 126 if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) { 128 throw new IllegalArgumentException ("Cannot create a DOMResult when the nextSibling is not contained by the node."); 129 } 130 } 131 132 setNode(node); 133 setNextSibling(nextSibling); 134 setSystemId(null); 135 } 136 137 166 public DOMResult(Node node, Node nextSibling, String systemId) { 167 168 if (nextSibling != null) { 170 if (node == null) { 172 throw new IllegalArgumentException ("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node."); 173 } 174 175 if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) { 177 throw new IllegalArgumentException ("Cannot create a DOMResult when the nextSibling is not contained by the node."); 178 } 179 } 180 181 setNode(node); 182 setNextSibling(nextSibling); 183 setSystemId(systemId); 184 } 185 186 207 public void setNode(Node node) { 208 if (nextSibling != null) { 210 if (node == null) { 212 throw new IllegalStateException ("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node."); 213 } 214 215 if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) { 217 throw new IllegalArgumentException ("Cannot create a DOMResult when the nextSibling is not contained by the node."); 218 } 219 } 220 221 this.node = node; 222 } 223 224 238 public Node getNode() { 239 return node; 240 } 241 242 262 public void setNextSibling(Node nextSibling) { 263 264 if (nextSibling != null) { 266 if (node == null) { 268 throw new IllegalStateException ("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node."); 269 } 270 271 if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) { 273 throw new IllegalArgumentException ("Cannot create a DOMResult when the nextSibling is not contained by the node."); 274 } 275 } 276 277 this.nextSibling = nextSibling; 278 } 279 280 293 public Node getNextSibling() { 294 return nextSibling; 295 } 296 297 302 public void setSystemId(String systemId) { 303 this.systemId = systemId; 304 } 305 306 317 public String getSystemId() { 318 return systemId; 319 } 320 321 325 328 private Node node = null; 329 330 335 private Node nextSibling = null; 336 337 340 private String systemId = null; 341 } 342 | Popular Tags |