/// <summary> /// Create a Processor. /// </summary> /// <param name="licensedEdition">Set to true if the Processor is to use a licensed edition of Saxon /// (that is, Saxon-PE or Saxon-EE). If true, the Processor will attempt to enable the capabilities /// of the licensed edition of Saxon, according to the version of the software that is loaded, and will /// verify the license key. If false, the Processor will load a default Configuration that gives restricted /// capability and does not require a license, regardless of which version of the software is actually being run.</param> /// <param name="loadLocally">This option has no effect at this release.</param> public Processor(bool licensedEdition, bool loadLocally) { if (licensedEdition) { config = JConfiguration.newConfiguration(); schemaManager = new SchemaManager(config); } else { config = new JConfiguration(); } config.registerExternalObjectModel(new DotNetObjectModelDefinition()); config.setProcessor(this); }
/// <summary> /// Create a Processor, indicating whether it is to be schema-aware. /// </summary> /// <param name="schemaAware">Set to true if the Processor is to be schema-aware. /// This requires the Saxon-SA product to be installed, with a valid license key.</param> /// <param name="loadLocally">Set to true if Saxon-SA is to be loaded from the application /// directory rather than from the Global Assembly Cache. This option should normally /// be set only when troubleshooting, for example when using a locally-patched version /// of the software.</param> public Processor(bool schemaAware, bool loadLocally) { if (schemaAware) { if (loadLocally) { Assembly asm = Assembly.Load("saxon8sa"); } else { try { int[] v = JVersion.getStructuredVersionNumber(); AssemblyName asn = new AssemblyName(); asn.Name = "saxon8sa"; asn.Version = new Version(v[0], v[1], v[2], v[3]); //asn.Version = new Version(JVersion.getMajorVersion(), JVersion.getMinorVersion()); asn.SetPublicKeyToken(new byte[] { 0xe1, 0xfd, 0xd0, 0x02, 0xd5, 0x08, 0x3f, 0xe6 }); asn.CultureInfo = new CultureInfo(""); Assembly asm = Assembly.Load(asn); // try to load the saxon8sa.dll assembly //Assembly asm = Assembly.Load("saxon8sa, Ver=" + JVersion.getProductVersion() + ".0.1, " + // @"SN=e1fdd002d5083fe6, Loc=neutral"); } catch (Exception e) { Console.WriteLine("Cannot load Saxon-SA software (assembly saxon8sa.dll version " + JVersion.getProductVersion() + ".0.1)"); throw e; } } config = JConfiguration.makeSchemaAwareConfiguration(null); schemaManager = new SchemaManager(config); } else { config = new JConfiguration(); } config.setURIResolver(new DotNetURIResolver(new XmlUrlResolver())); config.setCollectionURIResolver(new DotNetCollectionURIResolver()); }