1 23 24 package org.enhydra.xml.lazydom; 25 26 import org.enhydra.apache.xerces.dom.ProcessingInstructionImpl; 27 import org.w3c.dom.Document ; 28 import org.w3c.dom.Node ; 29 30 33 public class LazyProcessingInstruction extends ProcessingInstructionImpl implements LazyNode { 34 43 protected LazyProcessingInstruction(LazyDocument ownerDoc, 44 LazyProcessingInstruction template, 45 String target, 46 String data) { 47 super(ownerDoc, 48 (template != null) ? template.getTarget() : target, 49 (template != null) ? template.getData() : data); 50 if (template != null) { 51 fTemplateNode = template; 52 fNodeId = template.getNodeId(); 53 } 54 } 55 56 60 63 private LazyProcessingInstruction fTemplateNode = null; 64 65 69 public LazyProcessingInstruction getTemplateProcessingInstruction() { 70 return fTemplateNode; 71 } 72 73 76 public Node cloneNode(boolean deep) { 77 return super.cloneNode(deep); 79 } 80 81 85 88 private int fNodeId = NULL_NODE_ID; 89 90 93 private boolean fIsTemplateNode; 94 95 98 public void makeTemplateNode(int nodeId) { 99 fNodeId = nodeId; 100 fIsTemplateNode = true; 101 } 102 103 106 public int getNodeId() { 107 return fNodeId; 108 } 109 110 113 public boolean isTemplateNode() { 114 return fIsTemplateNode; 115 } 116 117 120 public LazyNode getTemplateNode() { 121 return fTemplateNode; 122 } 123 124 127 public LazyNode templateClone(Document ownerDocument) { 128 return new LazyProcessingInstruction((LazyDocument)ownerDocument, this, 129 null, null); 130 } 131 132 137 public void setNodeValue(String value) { 138 fNodeId = NULL_NODE_ID; 139 super.setNodeValue(value); 140 } 141 142 } 143 | Popular Tags |