Oh that is good.

I use this one:


                                String saxon_ee = System.getenv("XMLSH_SAXON_EE");

                                boolean bEE = Util.isEmpty(saxon_ee) ? true : Util.parseBoolean(saxon_ee);

                                mProcessor  = new Processor( bEE  );


But I like your method better.  One less env variable and the ability

to pass in a config.




David A. Lee




From: Michael Sokolov [mailto:msokolov@safaribooksonline.com]
Sent: Friday, May 17, 2013 7:12 PM
To: Mailing list for the SAXON XSLT and XQuery processor
Cc: Greg Sharek
Subject: Re: [saxon] Does IdentityTransformer requires a license in SaxonEE


On 5/17/2013 5:23 PM, Greg Sharek wrote:

Hi all,


I'm working on a project which includes SaxonEE, but allows the user to use SaxonHE if they don't have a Saxon license.    Our "no license" code path uses net.sf.saxon.TransformerFactoryImp

I ended up with a code path like this:

 private static Processor makeProcessor () {
        try {
            if (Class.forName("com.saxonica.config.EnterpriseConfiguration") != null) {
                return new Processor (true);
        } catch (ClassNotFoundException e) { }
        try {
            if (Class.forName("com.saxonica.config.ProfessionalConfiguration") != null) {
                return new Processor (true);
        } catch (ClassNotFoundException e) { }
        Processor p = new Processor (new Config());
        return p;

which detects which version is on the class path, and if it's PE or EE, creates the Processor as licensed, and otherwise, as unlicensed.