Author: mrglavas
Date: Wed Feb 22 21:23:19 2006
New Revision: 380043
URL: http://svn.apache.org/viewcvs?rev=380043&view=rev
Log:
JIRA Issue #1125:
http://issues.apache.org/jira/browse/XERCESJ-1125
Miscellaneous enhancements to the DOM code thanks to the patch from Nathan
Beyer.
I made one small modification to the instanceof improvement so that it checks
for null. This makes the change equivalent to the cast and catch of the
ClassCastException which was there before.
Modified:
xerces/java/trunk/src/org/apache/xerces/dom/AttrNSImpl.java
xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java
xerces/java/trunk/src/org/apache/xerces/dom/DeferredDocumentImpl.java
xerces/java/trunk/src/org/apache/xerces/dom/DocumentTypeImpl.java
xerces/java/trunk/src/org/apache/xerces/dom/NodeImpl.java
Modified: xerces/java/trunk/src/org/apache/xerces/dom/AttrNSImpl.java
URL:
http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/dom/AttrNSImpl.java?rev=380043&r1=380042&r2=380043&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/dom/AttrNSImpl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/dom/AttrNSImpl.java Wed Feb 22
21:23:19 2006
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2004,2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -156,7 +156,7 @@
String qualifiedName,
String localName){
- super.textNode = null;
+ AttrImpl.textNode = null;
super.flags = 0;
isSpecified(true);
hasStringValue(true);
Modified: xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java
URL:
http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java?rev=380043&r1=380042&r2=380043&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java Wed Feb 22
21:23:19 2006
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2002,2004,2005 The Apache Software Foundation.
+ * Copyright 1999-2002,2004-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -360,7 +360,7 @@
//removeDefault(attr, attributes);
attr.normalize();
if (fDocument.errorChecking &&
((fConfiguration.features & DOMConfigurationImpl.WELLFORMED) != 0)){
- isAttrValueWF(fErrorHandler, fError,
fLocator, attributes, (AttrImpl)attr, attr.getValue(),
fDocument.isXML11Version());
+ isAttrValueWF(fErrorHandler, fError,
fLocator, attributes, attr, attr.getValue(), fDocument.isXML11Version());
if (fDocument.isXMLVersionChanged()){
wellformed=CoreDocumentImpl.isXMLName(node.getNodeName() ,
fDocument.isXML11Version());
if (!wellformed){
@@ -672,7 +672,7 @@
String baseSystemId = fDocument.getDocumentURI();
String internalSubset = null;
- DocumentType docType = (DocumentType) fDocument.getDoctype();
+ DocumentType docType = fDocument.getDoctype();
if (docType != null) {
rootName = docType.getName();
publicId = docType.getPublicId();
@@ -739,7 +739,7 @@
//
// ------------------------------------
- String value, name, uri, prefix;
+ String value, uri, prefix;
if (attributes != null) {
// Record all valid local declarations
@@ -881,8 +881,7 @@
}
// normalize attribute value
attr.normalize();
- value = attr.getValue();
- name = attr.getNodeName();
+ value = attr.getValue();
uri = attr.getNamespaceURI();
// make sure that value is never null.
@@ -908,7 +907,7 @@
// check if value of the attribute is namespace well-formed
//---------------------------------------
if (fDocument.errorChecking && ((fConfiguration.features &
DOMConfigurationImpl.WELLFORMED) != 0)) {
- isAttrValueWF(fErrorHandler, fError, fLocator,
attributes, (AttrImpl)attr, attr.getValue(), fDocument.isXML11Version());
+ isAttrValueWF(fErrorHandler, fError, fLocator,
attributes, attr, attr.getValue(), fDocument.isXML11Version());
if (fDocument.isXMLVersionChanged()){
boolean
wellformed=CoreDocumentImpl.isXMLName(attr.getNodeName() ,
fDocument.isXML11Version());
if (!wellformed){
@@ -950,7 +949,6 @@
// conflict: attribute has a prefix that conficlicts
with a binding
// already active in scope
- name = attr.getNodeName();
// Find if any prefix for attributes namespace URI is
available
// in the scope
String declaredPrefix =
fNamespaceContext.getPrefix(uri);
Modified: xerces/java/trunk/src/org/apache/xerces/dom/DeferredDocumentImpl.java
URL:
http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/dom/DeferredDocumentImpl.java?rev=380043&r1=380042&r2=380043&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/dom/DeferredDocumentImpl.java
(original)
+++ xerces/java/trunk/src/org/apache/xerces/dom/DeferredDocumentImpl.java Wed
Feb 22 21:23:19 2006
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2002,2004,2005 The Apache Software Foundation.
+ * Copyright 1999-2002,2004-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -426,8 +426,6 @@
// get element's last attribute
int lastAttrNodeIndex = getChunkIndex(fNodeExtra, elementChunk,
elementIndex);
if (lastAttrNodeIndex != 0) {
- int lastAttrChunk = lastAttrNodeIndex >> CHUNK_SHIFT;
- int lastAttrIndex = lastAttrNodeIndex & CHUNK_MASK;
// add link from new attribute to last attribute
setChunkIndex(fNodePrevSib, lastAttrNodeIndex,
attrChunk, attrIndex);
}
Modified: xerces/java/trunk/src/org/apache/xerces/dom/DocumentTypeImpl.java
URL:
http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/dom/DocumentTypeImpl.java?rev=380043&r1=380042&r2=380043&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/dom/DocumentTypeImpl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/dom/DocumentTypeImpl.java Wed Feb
22 21:23:19 2006
@@ -288,7 +288,7 @@
Node entNode2 =
argEntities.getNamedItem(entNode1.getNodeName());
- if (!((NodeImpl) entNode1).isEqualNode((NodeImpl) entNode2))
+ if (!((NodeImpl) entNode1).isEqualNode(entNode2))
return false;
}
}
@@ -308,7 +308,7 @@
Node noteNode2 =
argNotations.getNamedItem(noteNode1.getNodeName());
- if (!((NodeImpl) noteNode1).isEqualNode((NodeImpl) noteNode2))
+ if (!((NodeImpl) noteNode1).isEqualNode(noteNode2))
return false;
}
}
Modified: xerces/java/trunk/src/org/apache/xerces/dom/NodeImpl.java
URL:
http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/dom/NodeImpl.java?rev=380043&r1=380042&r2=380043&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/dom/NodeImpl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/dom/NodeImpl.java Wed Feb 22
21:23:19 2006
@@ -973,9 +973,7 @@
return 0;
// check if other is from a different implementation
- try {
- NodeImpl node = (NodeImpl) other;
- } catch (ClassCastException e) {
+ if (other != null && !(other instanceof NodeImpl)) {
// other comes from a different implementation
String msg = DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN, "NOT_SUPPORTED_ERR", null);
@@ -1472,8 +1470,7 @@
switch (type) {
case Node.ELEMENT_NODE: {
-
- String namespace = this.getNamespaceURI(); // to flip out
children
+ this.getNamespaceURI(); // to flip out children
return lookupNamespacePrefix(namespaceURI, (ElementImpl)this);
}
case Node.DOCUMENT_NODE:{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]