You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Davanum Srinivas <di...@yahoo.com> on 2001/02/21 15:08:55 UTC

[C2][SAXON] One more fix needed in SAXON

Mike,

We need one more fix to be able to use SAXON (instead of Xalan in Cocoon2). See details below.

Thanks,
dims

File     : com\icl\saxon\Loader.java
Function : getClass (Lines 58-60)
Problem  : If the getContextClassLoader()'s loadClass fails 
           then we should try using Class.forName() before throwing an exception.
============================= Code ===================================
            try {
                ClassLoader loader = Thread.currentThread().getContextClassLoader();
                if (loader!=null) {
                    try {
                        return loader.loadClass(className);
                    } catch (Exception ex) {
                        return Class.forName(className);
                    }
                } else {
                    return Class.forName(className);
                }
            }
            catch (Exception e) {
                throw new TransformerException("Failed to load " + className, e );
            }
=============================================================================

--- Michael Kay <mh...@iclway.co.uk> wrote:
> Thanks for identifying this one. I'm afraid my testing of extension function
> mappings is one of the weaker areas in the test suite.
> 
> I'll refine the fix slightly so the code reads:
> 
>             } else if (arg instanceof NodeSetValue &&
>                              pclass==org.w3c.dom.NodeList.class) {
>                 if (arg instanceof org.w3c.dom.NodeList.class) {
>                     params[j++] = arg;
>                 } else {
>                     params[j++] = new
> NodeSetExtent(((NodeSetValue)arg).enumerate());
>                 }
> 
> This avoids copying the node-set if it is already a NodeSetExtent (or if I
> ever change NodeSetIntent to implement NodeList...)
> 
> Sounds as if it would be a good idea to try and get a patch release out next
> week.
> 
> Mike Kay
> 
> > -----Original Message-----
> > From: Davanum Srinivas [mailto:dims@yahoo.com]
> > Sent: 13 February 2001 15:49
> > To: mhkay@iclway.co.uk
> > Cc: cocoon-dev@xml.apache.org
> > Subject: RE: [C2][SAXON] NodeIterator/NodeList in SAXON extensions.
> >
> >
> > Mike,
> >
> > Here's a diff for com\icl\saxon\expr\FunctionProxy.java which
> > allows a NodeList to be used as a
> > parameter in extension functions. What should we do next?
> >
> > Thanks,
> > dims
> >
> > D:\saxon\src\com\icl\saxon\expr>diff FunctionProxy.java
> > FunctionProxy.new.java
> > ==============================================================
> > ======================
> > 465c465,466
> > <                 params[j++] = arg;
> > ---
> > >                 //params[j++] = arg;
> > >                 params[j++] = new
> > NodeSetExtent(((NodeSetValue)arg).enumerate());
> > ==============================================================
> > ======================
> >
> >
> > --- Davanum Srinivas <di...@yahoo.com> wrote:
> > > Mike,
> > >
> > > Included is an stripped-down extension sample which works
> > with Xalan and fails with SAXON. If we
> > > could resolve this Cocoon would be able to use SAXON as a
> > replacement for Xalan... Can you
> > > please
> > > help? If we could get SAXON to call either entry point
> > named getParameterSource then we are all
> > > set.
> > >
> > > Thanks,
> > > dims
> > >
> > > PS1: Please look into run.bat for running SAXON and
> > run2.bat for running under Xalan.
> > > PS2: Here's the stacktrace
> > >
> > > D:\junk\tryext>java TraxExamples date.xml date.xsl
> > > >>>> isFactory called:
> > > Error at xsl:value-of on line 25 of file:/D:/junk/tryext/date.xsl:
> > >   Argument is of wrong type: argument type mismatch
> > > EXCEPTION: javax.xml.transform.TransformerException:
> > Argument is of wrong type
> > > ; SystemID: file:/D:/junk/tryext/date.xsl; Line#: 25; Column#: -1
> > > javax.xml.transform.TransformerException: Argument is of wrong type
> > >         at
> > com.icl.saxon.style.StyleElement.styleError(StyleElement.java:784)
> > >         at
> > com.icl.saxon.style.StyleElement.processChildren(StyleElement.
> > java:613)
> > >         at com.icl.saxon.style.XSLIf.process(XSLIf.java:77)
> > >         at
> > com.icl.saxon.style.StyleElement.processChildren(StyleElement.
> > java:611)
> > >         at
> > com.icl.saxon.style.XSLForEach.process(XSLForEach.java:93)
> > >         at
> > com.icl.saxon.style.StyleElement.processChildren(StyleElement.
> > java:611)
> > >         at
> > com.icl.saxon.style.LiteralResultElement.process(LiteralResult
> > Element.java:288)
> > >         at
> > com.icl.saxon.style.StyleElement.processChildren(StyleElement.
> > java:611)
> > >         at
> > com.icl.saxon.style.XSLTemplate.realExpand(XSLTemplate.java:195)
> > >         at
> > com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:187)
> > >         at
> > com.icl.saxon.style.TemplateExpander.start(TemplateExpander.java:35)
> > >         at com.icl.saxon.Controller.visit(Controller.java:214)
> > >         at
> > com.icl.saxon.Controller.applyTemplates(Controller.java:259)
> > >         at com.icl.saxon.Controller.run(Controller.java:176)
> > >         at
> > com.icl.saxon.Controller.transformDocument(Controller.java:883)
> > >         at com.icl.saxon.Controller.transform(Controller.java:818)
> > >         at TraxExamples.exampleSimple1(TraxExamples.java:238)
> > >         at TraxExamples.main(TraxExamples.java:68)
> > > ---------
> > > java.lang.IllegalArgumentException: argument type mismatch
> > >         at java.lang.reflect.Method.invoke(Native Method)
> > >         at
> > com.icl.saxon.expr.FunctionProxy.evaluate(FunctionProxy.java:361)
> > >         at
> > com.icl.saxon.expr.Expression.evaluateAsString(Expression.java:116)
> > >         at
> > com.icl.saxon.expr.Expression.outputStringValue(Expression.java:127)
> > >         at
> > com.icl.saxon.style.XSLValueOf.process(XSLValueOf.java:93)
> > >         at
> > com.icl.saxon.style.StyleElement.processChildren(StyleElement.
> > java:611)
> > >         at com.icl.saxon.style.XSLIf.process(XSLIf.java:77)
> > >         at
> > com.icl.saxon.style.StyleElement.processChildren(StyleElement.
> > java:611)
> > >         at
> > com.icl.saxon.style.XSLForEach.process(XSLForEach.java:93)
> > >         at
> > com.icl.saxon.style.StyleElement.processChildren(StyleElement.
> > java:611)
> > >         at
> > com.icl.saxon.style.LiteralResultElement.process(LiteralResult
> > Element.java:288)
> > >         at
> > com.icl.saxon.style.StyleElement.processChildren(StyleElement.
> > java:611)
> > >         at
> > com.icl.saxon.style.XSLTemplate.realExpand(XSLTemplate.java:195)
> > >         at
> > com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:187)
> > >         at
> > com.icl.saxon.style.TemplateExpander.start(TemplateExpander.java:35)
> > >         at com.icl.saxon.Controller.visit(Controller.java:214)
> > >         at
> > com.icl.saxon.Controller.applyTemplates(Controller.java:259)
> > >         at com.icl.saxon.Controller.run(Controller.java:176)
> > >         at
> > com.icl.saxon.Controller.transformDocument(Controller.java:883)
> > >         at com.icl.saxon.Controller.transform(Controller.java:818)
> > >         at TraxExamples.exampleSimple1(TraxExamples.java:238)
> > >         at TraxExamples.main(TraxExamples.java:68)
> > >
> > >
> > > --- Michael Kay <mh...@iclway.co.uk> wrote:
> > > > A question about using a DOM NodeIterator to represent an
> > XSLT node-set:
> > > > what is getRoot() supposed to return?
> > > >
> > > > Mike Kay
> > > >
> > > > > -----Original Message-----
> > > > > From: Davanum Srinivas [mailto:dims@yahoo.com]
> > > > > Sent: 08 February 2001 17:54
> > > > > To: mhkay@iclway.co.uk
> > > > > Subject: [C2][SAXON] NodeIterator in SAXON extensions.
> > > > >
> > > > >
> > > > > Mike,
> > > > >
> > > > > Am an semi-active developer of Apache's Cocoon2 Project. We
> > > > > currently use Xerces1.2.3 and
> > > > > Xalan2.0.0. We want to be able to plugin SAXON instead of
> > > > > Xalan. We have standardized on TRaX so
> > > > > it should not be too big a problem. But one major problem is
> > > > > that we have some extensions which
> > > > > can accept NodeIterator's (see code snippet below). I went
> > > > > through the sources for Saxon6.2 and
> > > > > did not find any support for NodeIterator. Is this planned?
> > > > > Any suggestions are welcome.
> > > > >
> > > > > Thanks,
> > > > > dims
> > > > >
> > > > > public class XSLTFactoryLoader implements Loggable {
> > > > >     ...
> > > > >     ...
> > > > >     public String getClassSource(String className, String
> > > > > prefix, String pattern, NodeIterator
> > > > > conf)
> > > > >     throws ClassNotFoundException, InstantiationException,
> > > > > IllegalAccessException, Exception {
> > > > >     ...
> > > > >     }
> 
=== message truncated ===


=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/