1 5 6 package org.w3c.tidy; 7 8 import org.w3c.dom.DOMException ; 9 10 30 31 public class DOMElementImpl extends DOMNodeImpl 32 implements org.w3c.dom.Element { 33 34 protected DOMElementImpl(Node adaptee) 35 { 36 super(adaptee); 37 } 38 39 40 41 42 45 public short getNodeType() 46 { 47 return org.w3c.dom.Node.ELEMENT_NODE; 48 } 49 50 53 public String getTagName() 54 { 55 return super.getNodeName(); 56 } 57 58 61 public String getAttribute(String name) 62 { 63 if (this.adaptee == null) 64 return null; 65 66 AttVal att = this.adaptee.attributes; 67 while (att != null) { 68 if (att.attribute.equals(name)) break; 69 att = att.next; 70 } 71 if (att != null) 72 return att.value; 73 else 74 return ""; 75 } 76 77 80 public void setAttribute(String name, 81 String value) 82 throws DOMException 83 { 84 if (this.adaptee == null) 85 return; 86 87 AttVal att = this.adaptee.attributes; 88 while (att != null) { 89 if (att.attribute.equals(name)) break; 90 att = att.next; 91 } 92 if (att != null) { 93 att.value = value; 94 } else { 95 att = new AttVal(null, null, (int)'"', name, value); 96 att.dict = 97 AttributeTable.getDefaultAttributeTable().findAttribute(att); 98 if (this.adaptee.attributes == null) { 99 this.adaptee.attributes = att; 100 } else { 101 att.next = this.adaptee.attributes; 102 this.adaptee.attributes = att; 103 } 104 } 105 } 106 107 110 public void removeAttribute(String name) 111 throws DOMException 112 { 113 if (this.adaptee == null) 114 return; 115 116 AttVal att = this.adaptee.attributes; 117 AttVal pre = null; 118 while (att != null) { 119 if (att.attribute.equals(name)) break; 120 pre = att; 121 att = att.next; 122 } 123 if (att != null) { 124 if (pre == null) { 125 this.adaptee.attributes = att.next; 126 } else { 127 pre.next = att.next; 128 } 129 } 130 } 131 132 135 public org.w3c.dom.Attr getAttributeNode(String name) 136 { 137 if (this.adaptee == null) 138 return null; 139 140 AttVal att = this.adaptee.attributes; 141 while (att != null) { 142 if (att.attribute.equals(name)) break; 143 att = att.next; 144 } 145 if (att != null) 146 return att.getAdapter(); 147 else 148 return null; 149 } 150 151 154 public org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr newAttr) 155 throws DOMException 156 { 157 if (newAttr == null) 158 return null; 159 if (!(newAttr instanceof DOMAttrImpl)) { 160 throw new DOMExceptionImpl(DOMException.WRONG_DOCUMENT_ERR, 161 "newAttr not instanceof DOMAttrImpl"); 162 } 163 164 DOMAttrImpl newatt = (DOMAttrImpl)newAttr; 165 String name = newatt.avAdaptee.attribute; 166 org.w3c.dom.Attr result = null; 167 168 AttVal att = this.adaptee.attributes; 169 while (att != null) { 170 if (att.attribute.equals(name)) break; 171 att = att.next; 172 } 173 if (att != null) { 174 result = att.getAdapter(); 175 att.adapter = newAttr; 176 } else { 177 if (this.adaptee.attributes == null) { 178 this.adaptee.attributes = newatt.avAdaptee; 179 } else { 180 newatt.avAdaptee.next = this.adaptee.attributes; 181 this.adaptee.attributes = newatt.avAdaptee; 182 } 183 } 184 return result; 185 } 186 187 190 public org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr oldAttr) 191 throws DOMException 192 { 193 if (oldAttr == null) 194 return null; 195 196 org.w3c.dom.Attr result = null; 197 AttVal att = this.adaptee.attributes; 198 AttVal pre = null; 199 while (att != null) { 200 if (att.getAdapter() == oldAttr) break; 201 pre = att; 202 att = att.next; 203 } 204 if (att != null) { 205 if (pre == null) { 206 this.adaptee.attributes = att.next; 207 } else { 208 pre.next = att.next; 209 } 210 result = oldAttr; 211 } else { 212 throw new DOMExceptionImpl(DOMException.NOT_FOUND_ERR, 213 "oldAttr not found"); 214 } 215 return result; 216 } 217 218 221 public org.w3c.dom.NodeList getElementsByTagName(String name) 222 { 223 return new DOMNodeListByTagNameImpl(this.adaptee, name); 224 } 225 226 229 public void normalize() 230 { 231 } 233 234 237 public String getAttributeNS(String namespaceURI, String localName) 238 { 239 return null; 240 } 241 242 246 public void setAttributeNS(String namespaceURI, 247 String qualifiedName, 248 String value) 249 throws org.w3c.dom.DOMException 250 { 251 } 252 253 257 public void removeAttributeNS(String namespaceURI, String localName) 258 throws org.w3c.dom.DOMException 259 { 260 } 261 262 265 public org.w3c.dom.Attr getAttributeNodeNS(String namespaceURI, 266 String localName) 267 { 268 return null; 269 } 270 271 275 public org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr newAttr) 276 throws org.w3c.dom.DOMException 277 { 278 return null; 279 } 280 281 284 public org.w3c.dom.NodeList getElementsByTagNameNS(String namespaceURI, 285 String localName) 286 { 287 return null; 288 } 289 290 293 public boolean hasAttribute(String name) 294 { 295 return false; 296 } 297 298 301 public boolean hasAttributeNS(String namespaceURI, 302 String localName) 303 { 304 return false; 305 } 306 307 public org.w3c.dom.TypeInfo getSchemaTypeInfo() { 308 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl getSchemaTypeInfo() Not implemented"); 309 } 310 311 public void setIdAttributeNode(org.w3c.dom.Attr oAttr, boolean bSet) { 312 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl setIdAttributeNode() Not implemented"); 313 } 314 315 public void setIdAttribute(String sStr1, boolean bSet) { 316 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl setIdAttributeNode() Not implemented"); 317 } 318 319 public void setIdAttributeNS(String sStr1, String sStr2, boolean bSet) { 320 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl setIdAttributeNS() Not implemented"); 321 } 322 323 public org.w3c.dom.Node adoptNode (org.w3c.dom.Node oNode) { 324 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl adoptNode() Not implemented"); 325 } 326 327 public short compareDocumentPosition (org.w3c.dom.Node oNode) { 328 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl compareDocumentPosition() Not implemented"); 329 } 330 331 public boolean isDefaultNamespace(String sStr1) { 332 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl isDefaultNamespace() Not implemented"); 333 } 334 335 public boolean isEqualNode(org.w3c.dom.Node oNode) { 336 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl isEqualNode() Not implemented"); 337 } 338 339 public boolean isSameNode(org.w3c.dom.Node oNode) { 340 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl isSameNode() Not implemented"); 341 } 342 343 public String lookupPrefix(String sStr1) { 344 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl lookupPreffix() Not implemented"); 345 } 346 347 public String lookupNamespaceURI(String sStr1) { 348 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl lookupNamespaceURI() Not implemented"); 349 } 350 351 public String getDocumentURI() { 352 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl getDocumentURI() Not implemented"); 353 } 354 355 public void setDocumentURI(String sStr1) { 356 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl setDocumentURI() Not implemented"); 357 } 358 359 public boolean getStrictErrorChecking() { 360 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl getStrictErrorChecking() Not implemented"); 361 } 362 363 public void setStrictErrorChecking(boolean bStrictCheck) { 364 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl setStrictErrorChecking() Not implemented"); 365 } 366 367 public boolean getXmlStandalone() { 368 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl getXmlStandalone() Not implemented"); 369 } 370 371 public void setXmlStandalone(boolean bXmlStandalone) { 372 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl setXmlStandalone() Not implemented"); 373 } 374 375 public Object getFeature(String sStr1, String sStr2) { 376 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl getFeature() Not implemented"); 377 } 378 379 public String getInputEncoding() { 380 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl getInputEncoding() Not implemented"); 381 } 382 383 public String getXmlEncoding() { 384 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl getXmlEncoding() Not implemented"); 385 } 386 387 public String getXmlVersion() { 388 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl getXmlVersion() Not implemented"); 389 } 390 391 public void setXmlVersion(String sStr1) { 392 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl setXmlVersion() Not implemented"); 393 } 394 395 public Object getUserData(String sStr1) { 396 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl getUserData() Not implemented"); 397 } 398 399 public Object setUserData(String sStr1, Object oObj2, org.w3c.dom.UserDataHandler oHndlr) { 400 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl setUserData() Not implemented"); 401 } 402 403 public org.w3c.dom.DOMConfiguration getDomConfig () { 404 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl getDomConfig() Not implemented"); 405 } 406 407 public void normalizeDocument () { 408 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl normalizeDocument() Not implemented"); 409 } 410 411 public org.w3c.dom.Node renameNode (org.w3c.dom.Node oNode, String sStr1, String sStr2) { 412 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl renameNode() Not implemented"); 413 } 414 415 public String getBaseURI() { 416 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl getBaseURI() Not implemented"); 417 } 418 419 public String getTextContent() { 420 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl getTextContent() Not implemented"); 421 } 422 423 public void setTextContent(String sStr1) { 424 throw new UnsupportedOperationException ("org.w3c.tidy.DOMElementImpl setTextContent() Not implemented"); 425 } 426 427 } 428 | Popular Tags |