neeraj 2003/11/10 03:36:03
Modified: java/src/org/apache/xerces/dom CoreDocumentImpl.java
Log:
Added function to check if the document version was changed.. this would be useful
for DOMNormalizer to optimize name rules checks
. We should be checking names only when the document version changed at some point.
Revision Changes Path
1.55 +17 -2 xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java
Index: CoreDocumentImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- CoreDocumentImpl.java 10 Nov 2003 05:49:18 -0000 1.54
+++ CoreDocumentImpl.java 10 Nov 2003 11:36:03 -0000 1.55
@@ -220,6 +220,10 @@
/** Bypass error checking. */
protected boolean errorChecking = true;
+ //Did version change at any point when the document was created ?
+ //this field helps us to optimize when normalizingDocument.
+ protected boolean xmlVersionChanged = false ;
+
/** The following are required for compareDocumentPosition
*/
// Document number. Documents are ordered across the implementation using
@@ -810,11 +814,17 @@
/**
* DOM Level 3 WD - Experimental.
* version - An attribute specifying, as part of the XML declaration,
- * the version number of this document. This is null when unspecified
+ * the version number of this document.
*/
public void setXmlVersion(String value) {
if(value.equals("1.0") || value.equals("1.1")){
+ //we need to change the flag value only --
+ // when the version set is different than already set.
+ if(!getXmlVersion().equals(version)){
+ xmlVersionChanged = true ;
+ }
version = value;
+
}
else{
//NOT_SUPPORTED_ERR: Raised if the vesion is set to a value that is not
supported by
@@ -2408,6 +2418,11 @@
return true;
}
+ //we should be checking the (elements, attribute, entity etc.) names only when
+ //version of the document is changed.
+ boolean isXMLVersionChanged(){
+ return xmlVersionChanged ;
+ }
/**
* NON-DOM: kept for backward compatibility
* Store user data related to a given node
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]