1 18 package org.apache.batik.dom; 19 20 import org.w3c.dom.DOMException ; 21 import org.w3c.dom.Node ; 22 import org.w3c.dom.ProcessingInstruction ; 23 24 31 public abstract class AbstractProcessingInstruction 32 extends AbstractChildNode 33 implements ProcessingInstruction { 34 37 protected String data; 38 39 43 public String getNodeName() { 44 return getTarget(); 45 } 46 47 51 public short getNodeType() { 52 return PROCESSING_INSTRUCTION_NODE; 53 } 54 55 59 public String getNodeValue() throws DOMException { 60 return getData(); 61 } 62 63 66 public void setNodeValue(String nodeValue) throws DOMException { 67 setData(nodeValue); 68 } 69 70 75 public String getData() { 76 return data; 77 } 78 79 83 public void setData(String data) throws DOMException { 84 if (isReadonly()) { 85 throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, 86 "readonly.node", 87 new Object [] { new Integer (getNodeType()), 88 getNodeName() }); 89 } 90 String val = this.data; 91 this.data = data; 92 93 fireDOMCharacterDataModifiedEvent(val, this.data); 95 if (getParentNode() != null) { 96 ((AbstractParentNode)getParentNode()). 97 fireDOMSubtreeModifiedEvent(); 98 } 99 } 100 101 104 protected Node export(Node n, AbstractDocument d) { 105 AbstractProcessingInstruction p; 106 p = (AbstractProcessingInstruction)super.export(n, d); 107 p.data = data; 108 return p; 109 } 110 111 114 protected Node deepExport(Node n, AbstractDocument d) { 115 AbstractProcessingInstruction p; 116 p = (AbstractProcessingInstruction)super.deepExport(n, d); 117 p.data = data; 118 return p; 119 } 120 121 125 protected Node copyInto(Node n) { 126 AbstractProcessingInstruction p; 127 p = (AbstractProcessingInstruction)super.copyInto(n); 128 p.data = data; 129 return p; 130 } 131 132 136 protected Node deepCopyInto(Node n) { 137 AbstractProcessingInstruction p; 138 p = (AbstractProcessingInstruction)super.deepCopyInto(n); 139 p.data = data; 140 return p; 141 } 142 } 143 | Popular Tags |