1 19 20 package org.netbeans.modules.xml.text.syntax.dom; 21 22 import org.w3c.dom.*; 23 import org.netbeans.modules.xml.text.syntax.*; 24 import org.netbeans.modules.xml.spi.dom.*; 25 import org.netbeans.editor.*; 26 27 42 43 public abstract class SyntaxNode extends SyntaxElement implements Node { 44 45 46 public SyntaxNode(XMLSyntaxSupport support, TokenItem first, int to) { 47 super( support, first, to); 48 } 49 50 54 public Node getPreviousSibling() { 55 SyntaxNode prev = findPrevious(this); 56 57 if (prev instanceof StartTag) { 59 return null; 60 } else { 61 return prev; 62 } 63 } 64 65 68 static SyntaxNode findPrevious(SyntaxElement el) { 69 SyntaxElement prev = el.getPrevious(); 70 while ((prev instanceof SyntaxNode) == false) { 71 if (prev == null) return null; 72 prev = prev.getPrevious(); 73 } 74 return (SyntaxNode) prev; 75 } 76 77 80 SyntaxNode findPrevious() { 81 return findPrevious(this); 82 } 83 84 88 public Node getNextSibling() { 89 SyntaxNode next = findNext(this); 90 91 if (next instanceof EndTag) { 93 return null; 94 } else { 95 return next; 96 } 97 98 } 99 100 101 104 static SyntaxNode findNext(SyntaxElement el) { 105 SyntaxElement next = el.getNext(); 106 while ((next instanceof SyntaxNode) == false) { 107 if (next == null) return null; 108 next = next.getNext(); 109 } 110 return (SyntaxNode) next; 111 } 112 113 116 SyntaxNode findNext() { 117 return findNext(this); 118 } 119 120 125 public Node getParentNode() { 126 SyntaxNode prev = findPrevious(); 127 128 do { 129 130 while ( prev != null ) { 131 if (prev instanceof StartTag) { 132 return (Element) prev; 133 } else if (prev instanceof EndTag) { prev = ((EndTag)prev).getStartTag(); 135 if (prev == null) break; 136 prev = prev.findPrevious(); 137 } else { 138 prev = prev.findPrevious(); 139 } 140 } 141 142 if (prev == null) break; 143 144 } while ( (prev instanceof SyntaxNode) == false ); 145 146 if (prev != null) { 147 return (Node) prev; 148 } else { 149 return getOwnerDocument(); } 151 } 152 153 public org.w3c.dom.Document getOwnerDocument() { 154 return new DocumentImpl(this); 155 } 156 157 159 public String getNodeName() { 160 return null; 161 } 162 163 166 public boolean isSupported(String str, String str1) { 167 throw new UOException(); 168 } 169 170 public void setPrefix(String str) throws org.w3c.dom.DOMException { 171 throw new ROException(); 172 } 173 174 public String getPrefix() { 175 throw new UOException(); 176 } 177 178 181 public abstract short getNodeType(); 182 183 public org.w3c.dom.Node replaceChild(org.w3c.dom.Node node, org.w3c.dom.Node node1) throws org.w3c.dom.DOMException { 184 throw new ROException(); 185 } 186 187 public org.w3c.dom.Node cloneNode(boolean param) { 188 return (Node) this; } 190 191 public org.w3c.dom.Node insertBefore(org.w3c.dom.Node node, org.w3c.dom.Node node1) throws org.w3c.dom.DOMException { 192 throw new ROException(); 193 } 194 195 public String getNamespaceURI() { 196 throw new UOException(); 197 } 198 199 public org.w3c.dom.NamedNodeMap getAttributes() { 200 return NamedNodeMapImpl.EMPTY; 201 } 202 203 public org.w3c.dom.NodeList getChildNodes() { 204 return NodeListImpl.EMPTY; 205 } 206 207 public String getNodeValue() throws org.w3c.dom.DOMException { 208 return null; 210 } 211 212 public org.w3c.dom.Node appendChild(org.w3c.dom.Node node) throws org.w3c.dom.DOMException { 213 throw new ROException(); 214 } 215 216 public String getLocalName() { 217 throw new UOException(); 218 } 219 220 public void setNodeValue(String str) throws org.w3c.dom.DOMException { 221 throw new ROException(); 222 } 223 224 public org.w3c.dom.Node getLastChild() { 225 return null; 227 } 228 229 public boolean hasAttributes() { 230 throw new UOException(); 231 } 232 233 public void normalize() { 234 } 236 237 public org.w3c.dom.Node removeChild(org.w3c.dom.Node node) throws org.w3c.dom.DOMException { 238 throw new ROException(); 239 } 240 241 244 public boolean hasChildNodes() { 245 return false; 246 } 247 248 251 public org.w3c.dom.Node getFirstChild() { 252 return null; 253 } 254 255 259 public short compareDocumentPosition (Node a) { 260 throw new UOException(); 261 } 262 263 public String getBaseURI() { 264 throw new UOException(); 265 } 266 public Object getFeature(String a, String b) { 267 throw new UOException(); 268 } 269 public String getTextContent () { 270 throw new UOException(); 271 } 272 public Object getUserData(String a) { 273 throw new UOException(); 274 } 275 public boolean isDefaultNamespace (String a) { 276 throw new UOException(); 277 } 278 public boolean isEqualNode(Node a) { 279 throw new UOException(); 280 } 281 public boolean isSameNode(Node a) { 282 throw new UOException(); 283 } 284 public String lookupNamespaceURI(String a) { 285 throw new UOException(); 286 } 287 public String lookupPrefix(String a) { 288 throw new UOException(); 289 } 290 public void setTextContent(String a) { 291 throw new UOException(); 292 } 293 public Object setUserData(String a, Object b, UserDataHandler c) { 294 throw new UOException(); 295 } 296 public Text replaceWholeText (String a) { 298 throw new UOException (); 299 } 300 public String getWholeText() { 301 throw new UOException (); 302 } 303 public boolean isElementContentWhitespace() { 304 throw new UOException (); 305 } 306 public TypeInfo getSchemaTypeInfo() { 308 throw new UOException (); 309 } 310 public void setIdAttribute(String a, boolean b) { 311 throw new UOException (); 312 } 313 public void setIdAttributeNS(String a, String b, boolean c) { 314 throw new UOException (); 315 } 316 public void setIdAttributeNode(Attr a, boolean b) { 317 throw new UOException (); 318 } 319 320 } 321 | Popular Tags |