1 16 17 package org.apache.xerces.dom; 18 19 import java.lang.reflect.Constructor ; 20 import java.util.Enumeration ; 21 import java.util.Hashtable ; 22 import org.apache.xerces.util.URI; 23 24 import org.w3c.dom.DOMConfiguration ; 25 import org.w3c.dom.UserDataHandler ; 26 import org.apache.xerces.util.XMLChar; 27 import org.apache.xerces.util.XML11Char; 28 import org.apache.xerces.xni.NamespaceContext; 29 import org.w3c.dom.Attr ; 30 import org.w3c.dom.CDATASection ; 31 import org.w3c.dom.Comment ; 32 import org.w3c.dom.DOMException ; 33 import org.w3c.dom.DOMImplementation ; 34 import org.w3c.dom.Document ; 35 import org.w3c.dom.DocumentFragment ; 36 import org.w3c.dom.DocumentType ; 37 import org.w3c.dom.Element ; 38 import org.w3c.dom.Entity ; 39 import org.w3c.dom.EntityReference ; 40 import org.w3c.dom.NamedNodeMap ; 41 import org.w3c.dom.Node ; 42 import org.w3c.dom.NodeList ; 43 import org.w3c.dom.Notation ; 44 import org.w3c.dom.ProcessingInstruction ; 45 import org.w3c.dom.Text ; 46 import org.w3c.dom.events.Event ; 47 import org.w3c.dom.events.EventListener ; 48 import org.w3c.dom.ls.DOMImplementationLS ; 49 import org.w3c.dom.ls.LSSerializer ; 50 51 78 79 80 public class CoreDocumentImpl 81 extends ParentNode implements Document { 82 83 89 93 94 static final long serialVersionUID = 0; 95 96 100 102 103 protected DocumentTypeImpl docType; 104 105 106 protected ElementImpl docElement; 107 108 109 transient NodeListCache fFreeNLCache; 110 111 112 protected String encoding; 113 114 115 protected String actualEncoding; 116 117 118 protected String version; 119 120 121 protected boolean standalone; 122 123 124 protected String fDocumentURI; 125 126 128 protected Hashtable userData; 129 130 131 132 protected Hashtable identifiers; 133 134 transient DOMNormalizer domNormalizer = null; 136 transient DOMConfigurationImpl fConfiguration = null; 137 138 transient Object fXPathEvaluator = null; 140 141 142 private final static int[] kidOK; 143 144 178 protected int changes = 0; 179 180 182 183 protected boolean allowGrammarAccess; 184 185 186 protected boolean errorChecking = true; 187 188 protected boolean xmlVersionChanged = false ; 191 192 194 private int documentNumber=0; 197 private int nodeCounter = 0; 201 private Hashtable nodeTable; 202 private boolean xml11Version = false; 207 static { 208 209 kidOK = new int[13]; 210 211 kidOK[DOCUMENT_NODE] = 212 1 << ELEMENT_NODE | 1 << PROCESSING_INSTRUCTION_NODE | 213 1 << COMMENT_NODE | 1 << DOCUMENT_TYPE_NODE; 214 215 kidOK[DOCUMENT_FRAGMENT_NODE] = 216 kidOK[ENTITY_NODE] = 217 kidOK[ENTITY_REFERENCE_NODE] = 218 kidOK[ELEMENT_NODE] = 219 1 << ELEMENT_NODE | 1 << PROCESSING_INSTRUCTION_NODE | 220 1 << COMMENT_NODE | 1 << TEXT_NODE | 221 1 << CDATA_SECTION_NODE | 1 << ENTITY_REFERENCE_NODE ; 222 223 224 kidOK[ATTRIBUTE_NODE] = 225 1 << TEXT_NODE | 1 << ENTITY_REFERENCE_NODE; 226 227 kidOK[DOCUMENT_TYPE_NODE] = 228 kidOK[PROCESSING_INSTRUCTION_NODE] = 229 kidOK[COMMENT_NODE] = 230 kidOK[TEXT_NODE] = 231 kidOK[CDATA_SECTION_NODE] = 232 kidOK[NOTATION_NODE] = 233 0; 234 235 } 237 241 245 public CoreDocumentImpl() { 246 this(false); 247 } 248 249 250 public CoreDocumentImpl(boolean grammarAccess) { 251 super(null); 252 ownerDocument = this; 253 allowGrammarAccess = grammarAccess; 254 } 255 256 260 public CoreDocumentImpl(DocumentType doctype) { 261 this(doctype, false); 262 } 263 264 265 public CoreDocumentImpl(DocumentType doctype, boolean grammarAccess) { 266 this(grammarAccess); 267 if (doctype != null) { 268 DocumentTypeImpl doctypeImpl; 269 try { 270 doctypeImpl = (DocumentTypeImpl) doctype; 271 } catch (ClassCastException e) { 272 String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null); 273 throw new DOMException (DOMException.WRONG_DOCUMENT_ERR, msg); 274 } 275 doctypeImpl.ownerDocument = this; 276 appendChild(doctype); 277 } 278 } 279 280 284 final public Document getOwnerDocument() { 287 return null; 288 } 289 290 291 public short getNodeType() { 292 return Node.DOCUMENT_NODE; 293 } 294 295 296 public String getNodeName() { 297 return "#document"; 298 } 299 300 309 public Node cloneNode(boolean deep) { 310 311 CoreDocumentImpl newdoc = new CoreDocumentImpl(); 312 callUserDataHandlers(this, newdoc, UserDataHandler.NODE_CLONED); 313 cloneNode(newdoc, deep); 314 315 return newdoc; 316 317 } 319 320 323 protected void cloneNode(CoreDocumentImpl newdoc, boolean deep) { 324 325 if (needsSyncChildren()) { 327 synchronizeChildren(); 328 } 329 330 if (deep) { 331 Hashtable reversedIdentifiers = null; 332 333 if (identifiers != null) { 334 reversedIdentifiers = new Hashtable (); 336 Enumeration elementIds = identifiers.keys(); 337 while (elementIds.hasMoreElements()) { 338 Object elementId = elementIds.nextElement(); 339 reversedIdentifiers.put(identifiers.get(elementId), 340 elementId); 341 } 342 } 343 344 for (ChildNode kid = firstChild; kid != null; 346 kid = kid.nextSibling) { 347 newdoc.appendChild(newdoc.importNode(kid, true, true, 348 reversedIdentifiers)); 349 } 350 } 351 352 newdoc.allowGrammarAccess = allowGrammarAccess; 354 newdoc.errorChecking = errorChecking; 355 356 } 358 372 public Node insertBefore(Node newChild, Node refChild) 373 throws DOMException { 374 375 int type = newChild.getNodeType(); 377 if (errorChecking) { 378 if((type == Node.ELEMENT_NODE && docElement != null) || 379 (type == Node.DOCUMENT_TYPE_NODE && docType != null)) { 380 String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "HIERARCHY_REQUEST_ERR", null); 381 throw new DOMException (DOMException.HIERARCHY_REQUEST_ERR, msg); 382 } 383 } 384 if (newChild.getOwnerDocument() == null && 386 newChild instanceof DocumentTypeImpl) { 387 ((DocumentTypeImpl) newChild).ownerDocument = this; 388 } 389 super.insertBefore(newChild,refChild); 390 391 if (type == Node.ELEMENT_NODE) { 393 docElement = (ElementImpl)newChild; 394 } 395 else if (type == Node.DOCUMENT_TYPE_NODE) { 396 docType = (DocumentTypeImpl)newChild; 397 } 398 399 return newChild; 400 401 } 403 410 public Node removeChild(Node oldChild) throws DOMException { 411 412 super.removeChild(oldChild); 413 414 int type = oldChild.getNodeType(); 416 if(type == Node.ELEMENT_NODE) { 417 docElement = null; 418 } 419 else if (type == Node.DOCUMENT_TYPE_NODE) { 420 docType = null; 421 } 422 423 return oldChild; 424 425 } 427 434 public Node replaceChild(Node newChild, Node oldChild) 435 throws DOMException { 436 437 if (newChild.getOwnerDocument() == null && 439 newChild instanceof DocumentTypeImpl) { 440 ((DocumentTypeImpl) newChild).ownerDocument = this; 441 } 442 443 if (errorChecking &&((docType != null && 444 oldChild.getNodeType() != Node.DOCUMENT_TYPE_NODE && 445 newChild.getNodeType() == Node.DOCUMENT_TYPE_NODE) 446 || (docElement != null && 447 oldChild.getNodeType() != Node.ELEMENT_NODE && 448 newChild.getNodeType() == Node.ELEMENT_NODE))) { 449 450 throw new DOMException ( 451 DOMException.HIERARCHY_REQUEST_ERR, 452 DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "HIERARCHY_REQUEST_ERR", null)); 453 } 454 super.replaceChild(newChild, oldChild); 455 456 int type = oldChild.getNodeType(); 457 if(type == Node.ELEMENT_NODE) { 458 docElement = (ElementImpl)newChild; 459 } 460 else if (type == Node.DOCUMENT_TYPE_NODE) { 461 docType = (DocumentTypeImpl)newChild; 462 } 463 return oldChild; 464 } 466 470 public String getTextContent() throws DOMException { 471 return null; 472 } 473 474 478 public void setTextContent(String textContent) 479 throws DOMException { 480 } 482 483 486 public Object getFeature(String feature, String version) { 487 488 boolean anyVersion = version == null || version.length() == 0; 489 490 if ((feature.equalsIgnoreCase("+XPath")) 496 && (anyVersion || version.equals("3.0"))) { 497 498 if (fXPathEvaluator != null) { 501 return fXPathEvaluator; 502 } 503 504 try { 505 Class xpathClass = ObjectFactory.findProviderClass( 506 "org.apache.xpath.domapi.XPathEvaluatorImpl", 507 ObjectFactory.findClassLoader(), true); 508 Constructor xpathClassConstr = 509 xpathClass.getConstructor(new Class [] { Document .class }); 510 511 Class interfaces[] = xpathClass.getInterfaces(); 514 for (int i = 0; i < interfaces.length; i++) { 515 if (interfaces[i].getName().equals( 516 "org.w3c.dom.xpath.XPathEvaluator")) { 517 fXPathEvaluator = xpathClassConstr.newInstance(new Object [] { this }); 518 return fXPathEvaluator; 519 } 520 } 521 return null; 522 } catch (Exception e) { 523 return null; 524 } 525 } 526 return super.getFeature(feature, version); 527 } 528 529 533 535 545 public Attr createAttribute(String name) 546 throws DOMException { 547 548 if (errorChecking && !isXMLName(name,xml11Version)) { 549 String msg = 550 DOMMessageFormatter.formatMessage( 551 DOMMessageFormatter.DOM_DOMAIN, 552 "INVALID_CHARACTER_ERR", 553 null); 554 throw new DOMException (DOMException.INVALID_CHARACTER_ERR, msg); 555 } 556 return new AttrImpl(this, name); 557 558 } 560 569 public CDATASection createCDATASection(String data) 570 throws DOMException { 571 return new CDATASectionImpl(this, data); 572 } 573 574 579 public Comment createComment(String data) { 580 return new CommentImpl(this, data); 581 } 582 583 587 public DocumentFragment createDocumentFragment() { 588 return new DocumentFragmentImpl(this); 589 } 590 591 603 public Element createElement(String tagName) 604 throws DOMException { 605 606 if (errorChecking && !isXMLName(tagName,xml11Version)) { 607 String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null); 608 throw new DOMException (DOMException.INVALID_CHARACTER_ERR, msg); 609 } 610 return new ElementImpl(this, tagName); 611 612 } 614 624 public EntityReference createEntityReference(String name) 625 throws DOMException { 626 627 if (errorChecking && !isXMLName(name,xml11Version)) { 628 String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null); 629 throw new DOMException (DOMException.INVALID_CHARACTER_ERR, msg); 630 } 631 return new EntityReferenceImpl(this, name); 632 633 } 635 648 public ProcessingInstruction createProcessingInstruction(String target, 649 String data) 650 throws DOMException { 651 652 if (errorChecking && !isXMLName(target,xml11Version)) { 653 String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null); 654 throw new DOMException (DOMException.INVALID_CHARACTER_ERR, msg); 655 } 656 return new ProcessingInstructionImpl(this, target, data); 657 658 } 660 666 public Text createTextNode(String data) { 667 return new TextImpl(this, data); 668 } 669 670 672 677 public DocumentType getDoctype() { 678 if (needsSyncChildren()) { 679 synchronizeChildren(); 680 } 681 return docType; 682 } 683 684 685 694 public Element getDocumentElement() { 695 if (needsSyncChildren()) { 696 synchronizeChildren(); 697 } 698 return docElement; 699 } 700 701 710 public NodeList getElementsByTagName(String tagname) { 711 return new DeepNodeListImpl(this,tagname); 712 } 713 714 720 public DOMImplementation getImplementation() { 721 return CoreDOMImplementationImpl.getDOMImplementation(); 724 } 725 726 730 732 750 751 public void setErrorChecking(boolean check) { 752 errorChecking = check; 753 } 754 755 758 public void setStrictErrorChecking(boolean check) { 759 errorChecking = check; 760 } 761 762 765 public boolean getErrorChecking() { 766 return errorChecking; 767 } 768 769 772 public boolean getStrictErrorChecking() { 773 return errorChecking; 774 } 775 776 777 786 public String getInputEncoding() { 787 return actualEncoding; 788 } 789 790 799 public void setInputEncoding(String value) { 800 actualEncoding = value; 801 } 802 803 810 public void setXmlEncoding(String value) { 811 encoding = value; 812 } 813 814 819 public void setEncoding(String value) { 820 setXmlEncoding(value); 821 } 822 823 827 public String getXmlEncoding() { 828 return encoding; 829 } 830 831 836 public String getEncoding() { 837 return getXmlEncoding(); 838 } 839 840 845 public void setXmlVersion(String value) { 846 if(value.equals("1.0") || value.equals("1.1")){ 847 if(!getXmlVersion().equals(value)){ 850 xmlVersionChanged = true ; 851 isNormalized(false); 853 version = value; 854 } 855 } 856 else{ 857 String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_SUPPORTED_ERR", null); 861 throw new DOMException (DOMException.NOT_SUPPORTED_ERR, msg); 862 863 } 864 if((getXmlVersion()).equals("1.1")){ 865 xml11Version = true; 866 } 867 else{ 868 xml11Version = false; 869 } 870 } 871 872 877 public void setVersion(String value) { 878 setXmlVersion(value); 879 } 880 881 885 public String getXmlVersion() { 886 return (version == null)?"1.0":version; 887 } 888 889 894 public String getVersion() { 895 return getXmlVersion(); 896 } 897 898 908 public void setXmlStandalone(boolean value) 909 throws DOMException { 910 standalone = value; 911 } 912 913 918 public void setStandalone(boolean value) { 919 setXmlStandalone(value); 920 } 921 922 927 public boolean getXmlStandalone() { 928 return standalone; 929 } 930 931 936 public boolean getStandalone() { 937 return getXmlStandalone(); 938 } 939 940 948 public String getDocumentURI(){ 949 return fDocumentURI; 950 } 951 952 953 957 public Node renameNode(Node n,String namespaceURI,String name) 958 throws DOMException { 959 960 if (errorChecking && n.getOwnerDocument() != this && n != this) { 961 String msg = DOMMessageFormatter.formatMessage( 962 DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null); 963 throw new DOMException (DOMException.WRONG_DOCUMENT_ERR, msg); 964 } 965 switch (n.getNodeType()) { 966 case ELEMENT_NODE: { 967 ElementImpl el = (ElementImpl) n; 968 if (el instanceof ElementNSImpl) { 969 ((ElementNSImpl) el).rename(namespaceURI, name); 970 971 callUserDataHandlers(el, null, UserDataHandler.NODE_RENAMED); 973 } 974 else { 975 if (namespaceURI == null) { 976 if (errorChecking) { 977 int colon1 = name.indexOf(':'); 978 if(colon1 != -1){ 979 String msg = 980 DOMMessageFormatter.formatMessage( 981 DOMMessageFormatter.DOM_DOMAIN, 982 "NAMESPACE_ERR", 983 null); 984 throw new DOMException (DOMException.NAMESPACE_ERR, msg); 985 } 986 if (!isXMLName(name,xml11Version)) { 987 String msg = DOMMessageFormatter.formatMessage( 988 DOMMessageFormatter.DOM_DOMAIN, 989 "INVALID_CHARACTER_ERR", null); 990 throw new DOMException (DOMException.INVALID_CHARACTER_ERR, 991 msg); 992 } 993 } 994 el.rename(name); 995 996 callUserDataHandlers(el, null, 998 UserDataHandler.NODE_RENAMED); 999 } 1000 else { 1001 ElementNSImpl nel = 1003 new ElementNSImpl(this, namespaceURI, name); 1004 1005 copyEventListeners(el, nel); 1007 1008 Hashtable data = removeUserDataTable(el); 1010 1011 Node parent = el.getParentNode(); 1013 Node nextSib = el.getNextSibling(); 1014 if (parent != null) { 1015 parent.removeChild(el); 1016 } 1017 Node child = el.getFirstChild(); 1019 while (child != null) { 1020 el.removeChild(child); 1021 nel.appendChild(child); 1022 child = el.getFirstChild(); 1023 } 1024 nel.moveSpecifiedAttributes(el); 1026 1027 setUserDataTable(nel, data); 1029 1030 callUserDataHandlers(el, nel, 1032 UserDataHandler.NODE_RENAMED); 1033 1034 if (parent != null) { 1036 parent.insertBefore(nel, nextSib); 1037 } 1038 el = nel; 1039 } 1040 } 1041 renamedElement((Element ) n, el); 1043 return el; 1044 } 1045 case ATTRIBUTE_NODE: { 1046 AttrImpl at = (AttrImpl) n; 1047 1048 Element el = at.getOwnerElement(); 1050 if (el != null) { 1051 el.removeAttributeNode(at); 1052 } 1053 if (n instanceof AttrNSImpl) { 1054 ((AttrNSImpl) at).rename(namespaceURI, name); 1055 if (el != null) { 1057 el.setAttributeNodeNS(at); 1058 } 1059 1060 callUserDataHandlers(at, null, UserDataHandler.NODE_RENAMED); 1062 } 1063 else { 1064 if (namespaceURI == null) { 1065 at.rename(name); 1066 if (el != null) { 1068 el.setAttributeNode(at); 1069 } 1070 1071 callUserDataHandlers(at, null, UserDataHandler.NODE_RENAMED); 1073 } 1074 else { 1075 AttrNSImpl nat = new AttrNSImpl(this, namespaceURI, name); 1077 1078 copyEventListeners(at, nat); 1080 1081 Hashtable data = removeUserDataTable(at); 1083 1084 Node child = at.getFirstChild(); 1086 while (child != null) { 1087 at.removeChild(child); 1088 nat.appendChild(child); 1089 child = at.getFirstChild(); 1090 } 1091 1092 setUserDataTable(nat, data); 1094 1095 callUserDataHandlers(at, nat, UserDataHandler.NODE_RENAMED); 1097 1098 if (el != null) { 1100 el.setAttributeNode(nat); 1101 } 1102 at = nat; 1103 } 1104 } 1105 renamedAttrNode((Attr ) n, at); 1107 1108 return at; 1109 } 1110 default: { 1111 String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_SUPPORTED_ERR", null); 1112 throw new DOMException (DOMException.NOT_SUPPORTED_ERR, msg); 1113 } 1114 } 1115 1116 } 1117 1118 1119 1123 public void normalizeDocument(){ 1124 if (isNormalized() && !isNormalizeDocRequired()) { 1126 return; 1127 } 1128 if (needsSyncChildren()) { 1129 synchronizeChildren(); 1130 } 1131 1132 if (domNormalizer == null) { 1133 domNormalizer = new DOMNormalizer(); 1134 } 1135 1136 if (fConfiguration == null) { 1137 fConfiguration = new DOMConfigurationImpl(); 1138 } 1139 else { 1140 fConfiguration.reset(); 1141 } 1142 1143 domNormalizer.normalizeDocument(this, fConfiguration); 1144 isNormalized(true); 1145 xmlVersionChanged = false ; 1148 } 1149 1150 1151 1158 public DOMConfiguration getDomConfig(){ 1159 if (fConfiguration == null) { 1160 fConfiguration = new DOMConfigurationImpl(); 1161 } 1162 return fConfiguration; 1163 } 1164 1165 1166 1174 public String getBaseURI() { 1175 if (fDocumentURI != null && fDocumentURI.length() != 0 ) { try { 1177 return new URI(fDocumentURI).toString(); 1178 } 1179 catch (org.apache.xerces.util.URI.MalformedURIException e){ 1180 return null; 1182 } 1183 } 1184 return fDocumentURI; 1185 } 1186 1187 1190 public void setDocumentURI(String documentURI){ 1191 fDocumentURI = documentURI; 1192 } 1193 1194 1195 1212 public boolean getAsync() { 1213 return false; 1214 } 1215 1216 1230 public void setAsync(boolean async) { 1231 if (async) { 1232 String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_SUPPORTED_ERR", null); 1233 throw new DOMException (DOMException.NOT_SUPPORTED_ERR, msg); 1234 } 1235 } 1236 1243 public void abort() { 1244 } 1245 1246 1282 public boolean load(String uri) { 1283 return false; 1284 } 1285 1286 1294 public boolean loadXML(String source) { 1295 return false; 1296 } 1297 1298 1316 public String saveXML(Node node) 1317 throws DOMException { 1318 if ( errorChecking && node != null && 1319 this != node.getOwnerDocument() ) { 1320 String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null); 1321 throw new DOMException (DOMException.WRONG_DOCUMENT_ERR, msg); 1322 } 1323 DOMImplementationLS domImplLS = (DOMImplementationLS )DOMImplementationImpl.getDOMImplementation(); 1324 LSSerializer xmlWriter = domImplLS.createLSSerializer(); 1325 if (node == null) { 1326 node = this; 1327 } 1328 return xmlWriter.writeToString(node); 1329 } 1330 1331 1335 void setMutationEvents(boolean set) { 1336 } 1338 1339 1342 boolean getMutationEvents() { 1343 return false; 1345 } 1346 1347 1348 1349 1351 1362 public DocumentType createDocumentType(String qualifiedName, 1363 String publicID, 1364 String systemID) 1365 throws DOMException { 1366 1367 return new DocumentTypeImpl(this, qualifiedName, publicID, systemID); 1368 1369 } 1371 1383 public Entity createEntity(String name) 1384 throws DOMException { 1385 1386 1387 if (errorChecking && !isXMLName(name,xml11Version)) { 1388 String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null); 1389 throw new DOMException (DOMException.INVALID_CHARACTER_ERR, msg); 1390 } 1391 return new EntityImpl(this, name); 1392 1393 } 1395 1407 public Notation createNotation(String name) 1408 throws DOMException { 1409 1410 if (errorChecking && !isXMLName(name,xml11Version)) { 1411 String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null); 1412 throw new DOMException (DOMException.INVALID_CHARACTER_ERR, msg); 1413 } 1414 return new NotationImpl(this, name); 1415 1416 } 1418 1422 public ElementDefinitionImpl createElementDefinition(String name) 1423 throws DOMException { 1424 1425 if (errorChecking && !isXMLName(name,xml11Version)) { 1426 String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null); 1427 throw new DOMException (DOMException.INVALID_CHARACTER_ERR, msg); 1428 } 1429 return new ElementDefinitionImpl(this, name); 1430 1431 } 1433 1435 1438 protected int getNodeNumber() { 1439 if (documentNumber==0) { 1440 1441 CoreDOMImplementationImpl cd = (CoreDOMImplementationImpl)CoreDOMImplementationImpl.getDOMImplementation(); 1442 documentNumber = cd.assignDocumentNumber(); 1443 } 1444 return documentNumber; 1445 } 1446 1447 1448 1452 protected int getNodeNumber(Node node) { 1453 1454 int num; 1459 if (nodeTable == null) { 1460 nodeTable = new Hashtable (); 1461 num = --nodeCounter; 1462 nodeTable.put(node, new Integer (num)); 1463 } 1464 else { 1465 Integer n = (Integer )nodeTable.get(node); 1466 if (n== null) { 1467 num = --nodeCounter; 1468 nodeTable.put(node, new Integer (num)); 1469 } 1470 else 1471 num = n.intValue(); 1472 } 1473 return num; 1474 } 1475 1476 1485 public Node importNode(Node source, boolean deep) 1486 throws DOMException { 1487 return importNode(source, deep, false, null); 1488 } 1490 1502 private Node importNode(Node source, boolean deep, boolean cloningDoc, 1503 Hashtable reversedIdentifiers) 1504 throws DOMException { 1505 Node newnode=null; 1506 Hashtable userData = null; 1507 1508 if(source instanceof NodeImpl) 1520 userData = ((NodeImpl)source).getUserDataRecord(); 1521 int type = source.getNodeType(); 1522 switch (type) { 1523 case ELEMENT_NODE: { 1524 Element newElement; 1525 boolean domLevel20 = source.getOwnerDocument().getImplementation().hasFeature("XML", "2.0"); 1526 if(domLevel20 == false || source.getLocalName() == null) 1528 newElement = createElement(source.getNodeName()); 1529 else 1530 newElement = createElementNS(source.getNamespaceURI(), 1531 source.getNodeName()); 1532 1533 NamedNodeMap sourceAttrs = source.getAttributes(); 1535 if (sourceAttrs != null) { 1536 int length = sourceAttrs.getLength(); 1537 for (int index = 0; index < length; index++) { 1538 Attr attr = (Attr )sourceAttrs.item(index); 1539 1540 if (attr.getSpecified() || cloningDoc) { 1545 Attr newAttr = (Attr )importNode(attr, true, cloningDoc, 1546 reversedIdentifiers); 1547 1548 if (domLevel20 == false || 1551 attr.getLocalName() == null) 1552 newElement.setAttributeNode(newAttr); 1553 else 1554 newElement.setAttributeNodeNS(newAttr); 1555 } 1556 } 1557 } 1558 1559 if (reversedIdentifiers != null) { 1561 Object elementId = reversedIdentifiers.get(source); 1563 if (elementId != null) { 1564 if (identifiers == null) 1565 identifiers = new Hashtable (); 1566 1567 identifiers.put(elementId, newElement); 1568 } 1569 } 1570 1571 newnode = newElement; 1572 break; 1573 } 1574 1575 case ATTRIBUTE_NODE: { 1576 1577 if( source.getOwnerDocument().getImplementation().hasFeature("XML", "2.0") ){ 1578 if (source.getLocalName() == null) { 1579 newnode = createAttribute(source.getNodeName()); 1580 } else { 1581 newnode = createAttributeNS(source.getNamespaceURI(), 1582 source.getNodeName()); 1583 } 1584 } 1585 else { 1586 newnode = createAttribute(source.getNodeName()); 1587 } 1588 if (source instanceof AttrImpl) { 1591 AttrImpl attr = (AttrImpl) source; 1592 if (attr.hasStringValue()) { 1593 AttrImpl newattr = (AttrImpl) newnode; 1594 newattr.setValue(attr.getValue()); 1595 deep = false; 1596 } 1597 else { 1598 deep = true; 1599 } 1600 } 1601 else { 1602 if (source.getFirstChild() == null) { 1608 newnode.setNodeValue(source.getNodeValue()); 1609 deep = false; 1610 } else { 1611 deep = true; 1612 } 1613 } 1614 break; 1615 } 1616 1617 case TEXT_NODE: { 1618 newnode = createTextNode(source.getNodeValue()); 1619 break; 1620 } 1621 1622 case CDATA_SECTION_NODE: { 1623 newnode = createCDATASection(source.getNodeValue()); 1624 break; 1625 } 1626 1627 case ENTITY_REFERENCE_NODE: { 1628 newnode = createEntityReference(source.getNodeName()); 1629 deep = false; 1632 break; 1633 } 1634 1635 case ENTITY_NODE: { 1636 Entity srcentity = (Entity )source; 1637 EntityImpl newentity = 1638 (EntityImpl)createEntity(source.getNodeName()); 1639 newentity.setPublicId(srcentity.getPublicId()); 1640 newentity.setSystemId(srcentity.getSystemId()); 1641 newentity.setNotationName(srcentity.getNotationName()); 1642 newentity.isReadOnly(false); 1645 newnode = newentity; 1646 break; 1647 } 1648 1649 case PROCESSING_INSTRUCTION_NODE: { 1650 newnode = createProcessingInstruction(source.getNodeName(), 1651 source.getNodeValue()); 1652 break; 1653 } 1654 1655 case COMMENT_NODE: { 1656 newnode = createComment(source.getNodeValue()); 1657 break; 1658 } 1659 1660 case DOCUMENT_TYPE_NODE: { 1661 if (!cloningDoc) { 1664 String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_SUPPORTED_ERR", null); 1665 throw new DOMException (DOMException.NOT_SUPPORTED_ERR, msg); 1666 } 1667 DocumentType srcdoctype = (DocumentType )source; 1668 DocumentTypeImpl newdoctype = (DocumentTypeImpl) 1669 createDocumentType(srcdoctype.getNodeName(), 1670 srcdoctype.getPublicId(), 1671 srcdoctype.getSystemId()); 1672 NamedNodeMap smap = srcdoctype.getEntities(); 1674 NamedNodeMap tmap = newdoctype.getEntities(); 1675 if(smap != null) { 1676 for(int i = 0; i < smap.getLength(); i++) { 1677 tmap.setNamedItem(importNode(smap.item(i), true, true, 1678 reversedIdentifiers)); 1679 } 1680 } 1681 smap = srcdoctype.getNotations(); 1682 tmap = newdoctype.getNotations(); 1683 if (smap != null) { 1684 for(int i = 0; i < smap.getLength(); i++) { 1685 tmap.setNamedItem(importNode(smap.item(i), true, true, 1686 reversedIdentifiers)); 1687 } 1688 } 1689 1690 newnode = newdoctype; 1696 break; 1697 } 1698 1699 case DOCUMENT_FRAGMENT_NODE: { 1700 newnode = createDocumentFragment(); 1701 break; 1703 } 1704 1705 case NOTATION_NODE: { 1706 Notation srcnotation = (Notation )source; 1707 NotationImpl newnotation = 1708 (NotationImpl)createNotation(source.getNodeName()); 1709 newnotation.setPublicId(srcnotation.getPublicId()); 1710 newnotation.setSystemId(srcnotation.getSystemId()); 1711 newnode = newnotation; 1713 break; 1715 } 1716 case DOCUMENT_NODE : default: { String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_SUPPORTED_ERR", null); 1719 throw new DOMException (DOMException.NOT_SUPPORTED_ERR, msg); 1720 } 1721 } 1722 1723 if(userData != null) 1724 callUserDataHandlers(source, newnode, UserDataHandler.NODE_IMPORTED,userData); 1725 1726 if (deep) { 1728 for (Node srckid = source.getFirstChild(); 1729 srckid != null; 1730 srckid = srckid.getNextSibling()) { 1731 newnode.appendChild(importNode(srckid, true, cloningDoc, 1732 reversedIdentifiers)); 1733 } 1734 } 1735 if (newnode.getNodeType() == Node.ENTITY_NODE) { 1736 ((NodeImpl)newnode).setReadOnly(true, true); 1737 } 1738 return newnode; 1739 1740 } 1742 1749 public Node adoptNode(Node source) { 1750 NodeImpl node; 1751 Hashtable userData = null; 1752 try { 1753 node = (NodeImpl) source; 1754 } catch (ClassCastException e) { 1755 return null; 1757 } 1758 1759 1761 if (source == null ) { 1762 return null; 1763 } else if (source != null && source.getOwnerDocument() != null) { 1764 1765 DOMImplementation thisImpl = this.getImplementation(); 1766 DOMImplementation otherImpl = source.getOwnerDocument().getImplementation(); 1767 1768 if (thisImpl != otherImpl) { 1770 1771 if (thisImpl instanceof org.apache.xerces.dom.DOMImplementationImpl && 1773 otherImpl instanceof org.apache.xerces.dom.DeferredDOMImplementationImpl) { 1774 undeferChildren (node); 1776 } else if ( thisImpl instanceof org.apache.xerces.dom.DeferredDOMImplementationImpl 1777 && otherImpl instanceof org.apache.xerces.dom.DOMImplementationImpl) { 1778 } else { 1780 return null; 1782 } 1783 } 1784 } 1785 1786 switch (node.getNodeType()) { 1787 case ATTRIBUTE_NODE: { 1788 AttrImpl attr = (AttrImpl) node; 1789 if( attr.getOwnerElement() != null){ 1791 attr.getOwnerElement().removeAttributeNode(attr); 1793 } 1794 attr.isSpecified(true); 1796 userData = node.getUserDataRecord(); 1797 1798 attr.setOwnerDocument(this); 1800 if(userData != null ) 1801 setUserDataTable(node,userData); 1802 break; 1803 } 1804 case ENTITY_NODE: 1807 case NOTATION_NODE:{ 1808 String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null); 1809 throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); 1810 1811 } 1812 case DOCUMENT_NODE: 1815 case DOCUMENT_TYPE_NODE: { 1816 String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_SUPPORTED_ERR", null); 1817 throw new DOMException (DOMException.NOT_SUPPORTED_ERR, msg); 1818 } 1819 case ENTITY_REFERENCE_NODE: { 1820 userData = node.getUserDataRecord(); 1821 Node parent = node.getParentNode(); 1823 if (parent != null) { 1824 parent.removeChild(source); 1825 } 1826 Node child; 1828 while ((child = node.getFirstChild()) != null) { 1829 node.removeChild(child); 1830 } 1831 node.setOwnerDocument(this); 1833 if(userData != null) 1834 setUserDataTable(node,userData); 1835 if (docType == null) { 1837 break; 1838 } 1839 NamedNodeMap entities = docType.getEntities(); 1840 Node entityNode = entities.getNamedItem(node.getNodeName()); 1841 if (entityNode == null) { 1842 break; 1843 } 1844 for (child = entityNode.getFirstChild(); 1845 child != null; child = child.getNextSibling()) { 1846 Node childClone = child.cloneNode(true); 1847 node.appendChild(childClone); 1848 } 1849 break; 1850 } 1851 case ELEMENT_NODE: { 1852 userData = node.getUserDataRecord(); 1853 Node parent = node.getParentNode(); 1855 if (parent != null) { 1856 parent.removeChild(source); 1857 } 1858 node.setOwnerDocument(this); 1860 if(userData != null) 1861 setUserDataTable(node,userData); 1862 ((ElementImpl)node).reconcileDefaultAttributes(); 1864 break; 1865 } 1866 default: { 1867 userData = node.getUserDataRecord(); 1868 Node parent = node.getParentNode(); 1870 if (parent != null) { 1871 parent.removeChild(source); 1872 } 1873 node.setOwnerDocument(this); 1875 if(userData != null) 1876 setUserDataTable(node,userData); 1877 } 1878 } 1879 1880 if(userData != null) 1883 callUserDataHandlers(source, null, UserDataHandler.NODE_ADOPTED,userData); 1884 1885 return node; 1886 } 1887 1888 1893 protected void undeferChildren(Node node) { 1894 1895 Node top = node; 1896 1897 while (null != node) { 1898 1899 if (((NodeImpl)node).needsSyncData()) { 1900 ((NodeImpl)node).synchronizeData(); 1901 } 1902 1903 Node nextNode = null; 1904 nextNode = node.getFirstChild(); 1905 1906 while (null == nextNode) { 1907 1908 if (top.equals(node)) 1909 break; 1910 1911 nextNode = node.getNextSibling(); 1912 1913 if (null == nextNode) { 1914 node = node.getParentNode(); 1915 1916 if ((null == node) || (top.equals(node))) { 1917 nextNode = null; 1918 break; 1919 } 1920 } 1921 } 1922 1923 node = nextNode; 1924 } 1925 } 1926 1927 1940 public Element getElementById(String elementId) { 1941 return getIdentifier(elementId); 1942 } 1943 1944 1947 protected final void clearIdentifiers(){ 1948 if (identifiers != null){ 1949 identifiers.clear(); 1950 } 1951 } 1952 1953 1962 public void putIdentifier(String idName, Element element) { 1963 1964 if (element == null) { 1965 removeIdentifier(idName); 1966 return; 1967 } 1968 1969 if (needsSyncData()) { 1970 synchronizeData(); 1971 } 1972 1973 if (identifiers == null) { 1974 identifiers = new Hashtable (); 1975 } 1976 1977 identifiers.put(idName, element); 1978 1979 } 1981 1988 public Element getIdentifier(String idName) { 1989 1990 if (needsSyncData()) { 1991 synchronizeData(); 1992 } 1993 1994 if (identifiers == null) { 1995 return null; 1996 } 1997 Element elem = (Element ) identifiers.get(idName); 1998 if (elem != null) { 1999 Node parent = elem.getParentNode(); 2001 while (parent != null) { 2002 if (parent == this) { 2003 return elem; 2004 } 2005 parent = parent.getParentNode(); 2006 } 2007 } 2008 return null; 2009 } 2011 2018 public void removeIdentifier(String idName) { 2019 2020 if (needsSyncData()) { 2021 synchronizeData(); 2022 } 2023 2024 if (identifiers == null) { 2025 return; 2026 } 2027 2028 identifiers.remove(idName); 2029 2030 } 2032 2033 public Enumeration getIdentifiers() { 2034 2035 if (needsSyncData()) { 2036 synchronizeData(); 2037 } 2038 2039 if (identifiers == null) { 2040 identifiers = new Hashtable (); 2041 } 2042 2043 return identifiers.keys(); 2044 2045 } 2047 2051 2074 public Element createElementNS(String namespaceURI, String qualifiedName) 2075 throws DOMException { 2076 return new ElementNSImpl(this, namespaceURI, qualifiedName); 2077 } 2078 2079 2093 public Element createElementNS(String namespaceURI, String qualifiedName, 2094 String localpart) 2095 throws DOMException { 2096 return new ElementNSImpl(this, namespaceURI, qualifiedName, localpart); 2097 } 2098 2099 2117 public Attr createAttributeNS(String namespaceURI, String qualifiedName) 2118 throws DOMException { 2119 return new AttrNSImpl(this, namespaceURI, qualifiedName); 2120 } 2121 2122 2137 public Attr createAttributeNS(String namespaceURI, String qualifiedName, 2138 String localpart) 2139 throws DOMException { 2140 return new AttrNSImpl(this, namespaceURI, qualifiedName, localpart); 2141 } 2142 2143 2159 public NodeList getElementsByTagNameNS(String namespaceURI, 2160 String localName) { 2161 return new DeepNodeListImpl(this, namespaceURI, localName); 2162 } 2163 2164 2168 2169 public Object clone() throws CloneNotSupportedException { 2170 CoreDocumentImpl newdoc = (CoreDocumentImpl) super.clone(); 2171 newdoc.docType = null; 2172 newdoc.docElement = null; 2173 return newdoc; 2174 } 2175 2176 2180 2185 2186 public static final boolean isXMLName(String s, boolean xml11Version) { 2187 2188 if (s == null) { 2189 return false; 2190 } 2191 if(!xml11Version) 2192 return XMLChar.isValidName(s); 2193 else 2194 return XML11Char.isXML11ValidName(s); 2195 2196 } 2198 2205 public static final boolean isValidQName(String prefix, String local, boolean xml11Version) { 2206 2207 if (local == null) return false; 2209 boolean validNCName = false; 2210 2211 if (!xml11Version) { 2212 validNCName = (prefix == null || XMLChar.isValidNCName(prefix)) 2213 && XMLChar.isValidNCName(local); 2214 } 2215 else { 2216 validNCName = (prefix == null || XML11Char.isXML11ValidNCName(prefix)) 2217 && XML11Char.isXML11ValidNCName(local); 2218 } 2219 2220 return validNCName; 2221 } 2222 2226 2230 protected boolean isKidOK(Node parent, Node child) { 2231 if (allowGrammarAccess && 2232 parent.getNodeType() == Node.DOCUMENT_TYPE_NODE) { 2233 return child.getNodeType() == Node.ELEMENT_NODE; 2234 } 2235 return 0 != (kidOK[parent.getNodeType()] & 1 << child.getNodeType()); 2236 } 2237 2238 2241 protected void changed() { 2242 changes++; 2243 } 2244 2245 2248 protected int changes() { 2249 return changes; 2250 } 2251 2252 2254 2257 NodeListCache getNodeListCache(ParentNode owner) { 2258 if (fFreeNLCache == null) { 2259 return new NodeListCache(owner); 2260 } 2261 NodeListCache c = fFreeNLCache; 2262 fFreeNLCache = fFreeNLCache.next; 2263 c.fChild = null; 2264 c.fChildIndex = -1; 2265 c.fLength = -1; 2266 if (c.fOwner != null) { 2268 c.fOwner.fNodeListCache = null; 2269 } 2270 c.fOwner = owner; 2271 return c; 2273 } 2274 2275 2279 void freeNodeListCache(NodeListCache c) { 2280 c.next = fFreeNLCache; 2281 fFreeNLCache = c; 2282 } 2283 2284 2285 2286 2302 public Object setUserData(Node n, String key, 2303 Object data, UserDataHandler handler) { 2304 if (data == null) { 2305 if (userData != null) { 2306 Hashtable t = (Hashtable ) userData.get(n); 2307 if (t != null) { 2308 Object o = t.remove(key); 2309 if (o != null) { 2310 UserDataRecord r = (UserDataRecord) o; 2311 return r.fData; 2312 } 2313 } 2314 } 2315 return null; 2316 } 2317 else { 2318 Hashtable t; 2319 if (userData == null) { 2320 userData = new Hashtable (); 2321 t = new Hashtable (); 2322 userData.put(n, t); 2323 } 2324 else { 2325 t = (Hashtable ) userData.get(n); 2326 if (t == null) { 2327 t = new Hashtable (); 2328 userData.put(n, t); 2329 } 2330 } 2331 Object o = t.put(key, new UserDataRecord(data, handler)); 2332 if (o != null) { 2333 UserDataRecord r = (UserDataRecord) o; 2334 return r.fData; 2335 } 2336 return null; 2337 } 2338 } 2339 2340 2341 2351 public Object getUserData(Node n, String key) { 2352 if (userData == null) { 2353 return null; 2354 } 2355 Hashtable t = (Hashtable ) userData.get(n); 2356 if (t == null) { 2357 return null; 2358 } 2359 Object o = t.get(key); 2360 if (o != null) { 2361 UserDataRecord r = (UserDataRecord) o; 2362 return r.fData; 2363 } 2364 return null; 2365 } 2366 2367 protected Hashtable getUserDataRecord(Node n){ 2368 if (userData == null) { 2369 return null; 2370 } 2371 Hashtable t = (Hashtable ) userData.get(n); 2372 if (t == null) { 2373 return null; 2374 } 2375 return t; 2376 } 2377 2378 2383 Hashtable removeUserDataTable(Node n) { 2384 if (userData == null) { 2385 return null; 2386 } 2387 return (Hashtable ) userData.get(n); 2388 } 2389 2390 2395 void setUserDataTable(Node n, Hashtable data) { 2396 if (userData == null) 2397 userData = new Hashtable (); 2398 if (data != null) { 2399 userData.put(n, data); 2400 } 2401 } 2402 2403 2409 void callUserDataHandlers(Node n, Node c, short operation) { 2410 if (userData == null) { 2411 return; 2412 } 2413 if(n instanceof NodeImpl){ 2415 Hashtable t = ((NodeImpl)n).getUserDataRecord(); 2416 if (t == null || t.isEmpty()) { 2417 return; 2418 } 2419 callUserDataHandlers(n, c, operation,t); 2420 } 2421 } 2422 2423 2430 void callUserDataHandlers(Node n, Node c, short operation,Hashtable userData) { 2431 if (userData == null || userData.isEmpty()) { 2432 return; 2433 } 2434 Enumeration keys = userData.keys(); 2435 while (keys.hasMoreElements()) { 2436 String key = (String ) keys.nextElement(); 2437 UserDataRecord r = (UserDataRecord) userData.get(key); 2438 if (r.fHandler != null) { 2439 r.fHandler.handle(operation, key, r.fData, n, c); 2440 } 2441 } 2442 } 2443 2444 2453 2479 2480 protected final void checkNamespaceWF( String qname, int colon1, 2481 int colon2) { 2482 2483 if (!errorChecking) { 2484 return; 2485 } 2486 if (colon1 == 0 || colon1 == qname.length() - 1 || colon2 != colon1) { 2490 String msg = 2491 DOMMessageFormatter.formatMessage( 2492 DOMMessageFormatter.DOM_DOMAIN, 2493 "NAMESPACE_ERR", 2494 null); 2495 throw new DOMException (DOMException.NAMESPACE_ERR, msg); 2496 } 2497 } 2498 protected final void checkDOMNSErr(String prefix, 2499 String namespace) { 2500 if (errorChecking) { 2501 if (namespace == null) { 2502 String msg = 2503 DOMMessageFormatter.formatMessage( 2504 DOMMessageFormatter.DOM_DOMAIN, 2505 "NAMESPACE_ERR", 2506 null); 2507 throw new DOMException (DOMException.NAMESPACE_ERR, msg); 2508 } 2509 else if (prefix.equals("xml") 2510 && !namespace.equals(NamespaceContext.XML_URI)) { 2511 String msg = 2512 DOMMessageFormatter.formatMessage( 2513 DOMMessageFormatter.DOM_DOMAIN, 2514 "NAMESPACE_ERR", 2515 null); 2516 throw new DOMException (DOMException.NAMESPACE_ERR, msg); 2517 } 2518 else if ( 2519 prefix.equals("xmlns") 2520 && !namespace.equals(NamespaceContext.XMLNS_URI) 2521 || (!prefix.equals("xmlns") 2522 && namespace.equals(NamespaceContext.XMLNS_URI))) { 2523 String msg = 2524 DOMMessageFormatter.formatMessage( 2525 DOMMessageFormatter.DOM_DOMAIN, 2526 "NAMESPACE_ERR", 2527 null); 2528 throw new DOMException (DOMException.NAMESPACE_ERR, msg); 2529 } 2530 } 2531 } 2532 2533 2540 protected final void checkQName(String prefix, String local) { 2541 if (!errorChecking) { 2542 return; 2543 } 2544 2545 boolean validNCName = false; 2547 if (!xml11Version) { 2548 validNCName = (prefix == null || XMLChar.isValidNCName(prefix)) 2549 && XMLChar.isValidNCName(local); 2550 } 2551 else { 2552 validNCName = (prefix == null || XML11Char.isXML11ValidNCName(prefix)) 2553 && XML11Char.isXML11ValidNCName(local); 2554 } 2555 2556 if (!validNCName) { 2557 String msg = 2559 DOMMessageFormatter.formatMessage( 2560 DOMMessageFormatter.DOM_DOMAIN, 2561 "INVALID_CHARACTER_ERR", 2562 null); 2563 throw new DOMException (DOMException.INVALID_CHARACTER_ERR, msg); 2564 } 2565 } 2566 2567 2571 boolean isXML11Version(){ 2572 return xml11Version; 2573 } 2574 2575 boolean isNormalizeDocRequired(){ 2576 return true; 2579 } 2580 2581 boolean isXMLVersionChanged(){ 2584 return xmlVersionChanged ; 2585 } 2586 2593 protected void setUserData(NodeImpl n, Object data) { 2594 setUserData(n, "XERCES1DOMUSERDATA", data, null); 2595 } 2596 2597 2601 protected Object getUserData(NodeImpl n) { 2602 return getUserData(n, "XERCES1DOMUSERDATA"); 2603 } 2604 2605 2606 2608 protected void addEventListener(NodeImpl node, String type, 2609 EventListener listener, 2610 boolean useCapture) { 2611 } 2613 2614 protected void removeEventListener(NodeImpl node, String type, 2615 EventListener listener, 2616 boolean useCapture) { 2617 } 2619 2620 protected void copyEventListeners(NodeImpl src, NodeImpl tgt) { 2621 } 2623 2624 protected boolean dispatchEvent(NodeImpl node, Event event) { 2625 return false; 2627 } 2628 2629 2631 2635 void replacedText(NodeImpl node) { 2636 } 2637 2638 2642 void deletedText(NodeImpl node, int offset, int count) { 2643 } 2644 2645 2649 void insertedText(NodeImpl node, int offset, int count) { 2650 } 2651 2652 2655 void modifyingCharacterData(NodeImpl node, boolean replace) { 2656 } 2657 2658 2661 void modifiedCharacterData(NodeImpl node, String oldvalue, String value, boolean replace) { 2662 } 2663 2664 2667 void insertingNode(NodeImpl node, boolean replace) { 2668 } 2669 2670 2673 void insertedNode(NodeImpl node, NodeImpl newInternal, boolean replace) { 2674 } 2675 2676 2679 void removingNode(NodeImpl node, NodeImpl oldChild, boolean replace) { 2680 } 2681 2682 2685 void removedNode(NodeImpl node, boolean replace) { 2686 } 2687 2688 2691 void replacingNode(NodeImpl node) { 2692 } 2693 2694 2697 void replacedNode(NodeImpl node) { 2698 } 2699 2700 2703 void replacingData(NodeImpl node) { 2704 } 2705 2706 2709 void replacedCharacterData(NodeImpl node, String oldvalue, String value) { 2710 } 2711 2712 2713 2716 void modifiedAttrValue(AttrImpl attr, String oldvalue) { 2717 } 2718 2719 2722 void setAttrNode(AttrImpl attr, AttrImpl previous) { 2723 } 2724 2725 2728 void removedAttrNode(AttrImpl attr, NodeImpl oldOwner, String name) { 2729 } 2730 2731 2734 void renamedAttrNode(Attr oldAt, Attr newAt) { 2735 } 2736 2737 2740 void renamedElement(Element oldEl, Element newEl) { 2741 } 2742 2743} | Popular Tags |