1 23 24 package org.enhydra.xml.lazydom; 25 26 import org.enhydra.apache.xerces.dom.NotationImpl; 27 import org.w3c.dom.Document ; 28 import org.w3c.dom.Node ; 29 30 33 public class LazyNotation extends NotationImpl implements LazyNode { 34 45 protected LazyNotation(LazyDocument ownerDoc, 46 LazyNotation template, 47 String name, 48 String publicId, 49 String systemId) { 50 super(ownerDoc, 51 (template != null) ? template.getNodeName() : name); 52 if (template != null) { 53 if (template.getPublicId() != null) { 54 setPublicId(template.getPublicId()); 55 } 56 if (template.getSystemId() != null) { 57 setSystemId(template.getSystemId()); 58 } 59 fTemplateNode = template; 60 fNodeId = template.getNodeId(); 61 } else { 62 if (publicId != null) { 63 setPublicId(publicId); 64 } 65 if (systemId != null) { 66 setSystemId(systemId); 67 } 68 } 69 } 70 71 75 78 private LazyNotation fTemplateNode = null; 79 80 84 public LazyNotation getTemplateNotation() { 85 return fTemplateNode; 86 } 87 88 91 public Node cloneNode(boolean deep) { 92 LazyNotation newNotation = (LazyNotation)super.cloneNode(deep); 94 newNotation.fNodeId = NULL_NODE_ID; 95 return newNotation; 96 } 97 98 102 105 private int fNodeId = NULL_NODE_ID; 106 107 110 private boolean fIsTemplateNode; 111 112 115 public void makeTemplateNode(int nodeId) { 116 fNodeId = nodeId; 117 fIsTemplateNode = true; 118 } 119 120 123 public int getNodeId() { 124 return fNodeId; 125 } 126 127 130 public boolean isTemplateNode() { 131 return fIsTemplateNode; 132 } 133 134 137 public LazyNode getTemplateNode() { 138 return fTemplateNode; 139 } 140 141 144 public LazyNode templateClone(Document ownerDocument) { 145 return new LazyNotation((LazyDocument)ownerDocument, this, 146 null, null, null); 147 } 148 149 154 public void setNodeValue(String value) { 155 fNodeId = NULL_NODE_ID; 156 super.setNodeValue(value); 157 } 158 159 } 160 | Popular Tags |