You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by jk...@apache.org on 2001/12/13 16:31:35 UTC
cvs commit: xml-xalan/java/src/org/apache/xml/dtm/ref IncrementalSAXSource_Xerces.java
jkesselm 01/12/13 07:31:35
Modified: java/src/org/apache/xml/dtm/ref
IncrementalSAXSource_Xerces.java
Log:
Bugzilla5272 patch suggested by Sandy Gao.
This startup sequence for incremental SAX parsing under Xerces2
really is excessively complicated and excessively fragile as a result.
Not to mention being underdocumented. We really need to push the
Xerces folks to provide a simple incremental SAX API, similar to that
in the Xerces1incremental prototype.
Revision Changes Path
1.7 +29 -18 xml-xalan/java/src/org/apache/xml/dtm/ref/IncrementalSAXSource_Xerces.java
Index: IncrementalSAXSource_Xerces.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/IncrementalSAXSource_Xerces.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- IncrementalSAXSource_Xerces.java 2001/11/02 21:02:15 1.6
+++ IncrementalSAXSource_Xerces.java 2001/12/13 15:31:35 1.7
@@ -80,24 +80,25 @@
public class IncrementalSAXSource_Xerces
implements IncrementalSAXSource
{
- //
- // Reflection. To allow this to compile with both Xerces1 and Xerces2, which
- // require very different methods and objects, we need to avoid static
- // references to those APIs. So until Xerces2 is pervasive and we're willing
- // to make it a prerequisite, we will rely upon relection.
- //
- Method fParseSomeSetup=null; // Xerces1 method
- Method fParseSome=null; // Xerces1 method
- Object fPullParserConfig=null; // Xerces2 pull control object
- Method fConfigSetInput=null; // Xerces2 method
- Method fConfigParse=null; // Xerces2 method
- Method fSetInputSource=null; // Xerces2 pull control method
- Constructor fConfigInputSourceCtor=null; // Xerces2 initialization method
- Method fConfigSetByteStream=null; // Xerces2 initialization method
- Method fConfigSetCharStream=null; // Xerces2 initialization method
- Method fConfigSetEncoding=null; // Xerces2 initialization method
-
//
+ // Reflection. To allow this to compile with both Xerces1 and Xerces2, which
+ // require very different methods and objects, we need to avoid static
+ // references to those APIs. So until Xerces2 is pervasive and we're willing
+ // to make it a prerequisite, we will rely upon relection.
+ //
+ Method fParseSomeSetup=null; // Xerces1 method
+ Method fParseSome=null; // Xerces1 method
+ Object fPullParserConfig=null; // Xerces2 pull control object
+ Method fConfigSetInput=null; // Xerces2 method
+ Method fConfigParse=null; // Xerces2 method
+ Method fSetInputSource=null; // Xerces2 pull control method
+ Constructor fConfigInputSourceCtor=null; // Xerces2 initialization method
+ Method fConfigSetByteStream=null; // Xerces2 initialization method
+ Method fConfigSetCharStream=null; // Xerces2 initialization method
+ Method fConfigSetEncoding=null; // Xerces2 initialization method
+ Method fReset=null; // Both Xerces1 and Xerces2, but diff. signatures
+
+ //
// Data
//
SAXParser fIncrementalParser;
@@ -159,9 +160,11 @@
fConfigSetCharStream=fXniInputSourceClass.getMethod("setCharacterStream",args6);
Class[] args7={String.class};
fConfigSetEncoding=fXniInputSourceClass.getMethod("setEncoding",args7);
-
+
Class[] argsb={Boolean.TYPE};
fConfigParse=xniStdConfigClass.getMethod("parse",argsb);
+ Class[] noargs=new Class[0];
+ fReset=fIncrementalParser.getClass().getMethod("reset",noargs);
}
catch(Exception e)
{
@@ -356,6 +359,14 @@
fConfigSetCharStream.invoke(xmlsource,parmsa);
parmsa[0]=source.getEncoding();
fConfigSetEncoding.invoke(xmlsource,parmsa);
+
+ // Bugzilla5272 patch suggested by Sandy Gao.
+ // Has to be reflection to run with Xerces2
+ // after compilation against Xerces1. or vice
+ // versa, due to return type mismatches.
+ Object[] noparms=new Object[0];
+ fReset.invoke(fIncrementalParser,noparms);
+
parmsa[0]=xmlsource;
fConfigSetInput.invoke(fPullParserConfig,parmsa);
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org