sandygao 2002/10/25 09:44:42
Modified: java/src/org/apache/xerces/impl
XMLNSDocumentScannerImpl.java
java/src/org/apache/xerces/parsers
IntegratedParserConfiguration.java
NonValidatingConfiguration.java
Log:
We can dynamically figure out the component before and after the DTD
validator, so we don't need to pass such kind of information to the namespace
scanner.
Revision Changes Path
1.6 +10 -22
xml-xerces/java/src/org/apache/xerces/impl/XMLNSDocumentScannerImpl.java
Index: XMLNSDocumentScannerImpl.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLNSDocumentScannerImpl.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XMLNSDocumentScannerImpl.java 7 Oct 2002 14:14:38 -0000 1.5
+++ XMLNSDocumentScannerImpl.java 25 Oct 2002 16:44:42 -0000 1.6
@@ -72,6 +72,7 @@
import org.apache.xerces.xni.NamespaceContext;
import org.apache.xerces.xni.XMLString;
import org.apache.xerces.xni.XNIException;
+import org.apache.xerces.xni.parser.XMLDocumentSource;
import org.apache.xerces.xni.XMLDocumentHandler;
import org.apache.xerces.xni.parser.XMLDocumentFilter;
import org.apache.xerces.xni.parser.XMLComponentManager;
@@ -126,13 +127,8 @@
// private data
//
- /** The filter component before DTD validator if any. If the DTDValidator
- followed the scanner, this field is null.*/
- private XMLDocumentFilter fPreviousComponent;
/** DTD validator */
private XMLDTDValidatorFilter fDTDValidator;
- /** The document handler (of filter) after the DTD validator */
- private XMLDocumentHandler fNextComponent;
/**
@@ -144,11 +140,8 @@
* The DTDValidator
* @param next The documentHandler after the DTDValidator
*/
- public void setComponents(XMLDocumentFilter previous, XMLDTDValidatorFilter
dtd,
- XMLDocumentHandler next){
- fPreviousComponent = previous;
+ public void setDTDValidator(XMLDTDValidatorFilter dtd){
fDTDValidator = dtd;
- fNextComponent = next;
}
/**
@@ -604,17 +597,13 @@
fBindNamespaces = true;
fPerformValidation = fDTDValidator.validate();
// re-configure pipeline
- //
- if (fPreviousComponent != null) {
- // there is a filter component between scanner and DTDValidator
- fPreviousComponent.setDocumentHandler(fNextComponent);
- fNextComponent.setDocumentSource(fPreviousComponent);
- }
- else {
- // DTD validator was the next component after the scanner.
- fDocumentHandler = fNextComponent;
- fNextComponent.setDocumentSource(XMLNSDocumentScannerImpl.this);
- }
+ XMLDocumentSource source = fDTDValidator.getDocumentSource();
+ XMLDocumentHandler handler = fDTDValidator.getDocumentHandler();
+ source.setDocumentHandler(handler);
+ if (handler != null)
+ handler.setDocumentSource(source);
+ fDTDValidator.setDocumentSource(null);
+ fDTDValidator.setDocumentHandler(null);
}
if (scanStartElement()) {
@@ -628,4 +617,3 @@
}
} // class XMLDocumentScannerImpl
-
1.6 +3 -3
xml-xerces/java/src/org/apache/xerces/parsers/IntegratedParserConfiguration.java
Index: IntegratedParserConfiguration.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/IntegratedParserConfiguration.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- IntegratedParserConfiguration.java 25 Sep 2002 02:50:37 -0000 1.5
+++ IntegratedParserConfiguration.java 25 Oct 2002 16:44:42 -0000 1.6
@@ -235,7 +235,7 @@
fProperties.put(DTD_VALIDATOR, fDTDValidator);
fProperties.put(DOCUMENT_SCANNER, fNamespaceScanner);
fScanner = fNamespaceScanner;
- fNamespaceScanner.setComponents(null, fDTDValidator, fSchemaValidator);
+ fNamespaceScanner.setDTDValidator(fDTDValidator);
fNamespaceScanner.setDocumentHandler(fDTDValidator);
fDTDValidator.setDocumentSource(fNamespaceScanner);
fDTDValidator.setDocumentHandler(fSchemaValidator);
@@ -250,7 +250,7 @@
fScanner = fNamespaceScanner;
fProperties.put(DTD_VALIDATOR, fDTDValidator);
fProperties.put(DOCUMENT_SCANNER, fNamespaceScanner);
- fNamespaceScanner.setComponents(null, fDTDValidator,
fDocumentHandler);
+ fNamespaceScanner.setDTDValidator(fDTDValidator);
fNamespaceScanner.setDocumentHandler(fDTDValidator);
fDTDValidator.setDocumentSource(fNamespaceScanner);
fDTDValidator.setDocumentHandler(fDocumentHandler);
1.7 +2 -2
xml-xerces/java/src/org/apache/xerces/parsers/NonValidatingConfiguration.java
Index: NonValidatingConfiguration.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/NonValidatingConfiguration.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- NonValidatingConfiguration.java 25 Sep 2002 15:53:47 -0000 1.6
+++ NonValidatingConfiguration.java 25 Oct 2002 16:44:42 -0000 1.7
@@ -609,7 +609,7 @@
addComponent((XMLComponent)fNamespaceScanner);
}
fProperties.put(DOCUMENT_SCANNER, fNamespaceScanner);
- fNamespaceScanner.setComponents(null, null, fDocumentHandler);
+ fNamespaceScanner.setDTDValidator(null);
fScanner = fNamespaceScanner;
}
else {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]