saxon9

16:52:05.402 INFO  jd.cli.Main - Decompiling saxon9.jar
package net.sf.saxon;

import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
import javax.xml.transform.ErrorListener;
import javax.xml.transform.Source;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
import net.sf.saxon.event.ProxyReceiver;
import net.sf.saxon.om.StructuredQName;
import net.sf.saxon.type.SchemaType;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;

public class AugmentedSource
  implements Source
{
  private Source source;
  private int schemaValidation = 0;
  private int dtdValidation = 0;
  private StructuredQName topLevelElement;
  private SchemaType topLevelType;
  private XMLReader parser = null;
  private Boolean wrapDocument = null;
  private int treeModel = -1;
  private int stripSpace;
  private Boolean lineNumbering = null;
  private Boolean xIncludeAware = null;
  private boolean pleaseClose = false;
  private EntityResolver entityResolver = null;
  private ErrorListener errorListener = null;
  private List filters = null;
  
  private AugmentedSource(Source source)
  {
    if ((source instanceof AugmentedSource)) {
      throw new IllegalArgumentException("Contained source must not be an AugmentedSource");
    }
    this.source = source;
  }
  
  public static AugmentedSource makeAugmentedSource(Source source)
  {
    if ((source instanceof AugmentedSource)) {
      return (AugmentedSource)source;
    }
    return new AugmentedSource(source);
  }
  
  public void addFilter(ProxyReceiver filter)
  {
    if (filters == null) {
      filters = new ArrayList(5);
    }
    filters.add(filter);
  }
  
  public List getFilters()
  {
    return filters;
  }
  
  public Source getContainedSource()
  {
    return source;
  }
  
  public void setStripSpace(int stripAction)
  {
    stripSpace = stripAction;
  }
  
  public int getStripSpace()
  {
    return stripSpace;
  }
  
  public void setTreeModel(int model)
  {
    if ((model != 1) && (model != 0)) {
      throw new IllegalArgumentException("model must be Builder.TINY_TREE or Builder.LINKED_TREE");
    }
    treeModel = model;
  }
  
  public int getTreeModel()
  {
    return treeModel;
  }
  
  public void setSchemaValidationMode(int option)
  {
    schemaValidation = option;
  }
  
  public int getSchemaValidation()
  {
    return schemaValidation;
  }
  
  public void setTopLevelElement(StructuredQName elementName)
  {
    topLevelElement = elementName;
  }
  
  public StructuredQName getTopLevelElement()
  {
    return topLevelElement;
  }
  
  public void setTopLevelType(SchemaType type)
  {
    topLevelType = type;
  }
  
  public SchemaType getTopLevelType()
  {
    return topLevelType;
  }
  
  public void setDTDValidationMode(int option)
  {
    dtdValidation = option;
  }
  
  public int getDTDValidation()
  {
    return dtdValidation;
  }
  
  public void setLineNumbering(boolean lineNumbering)
  {
    this.lineNumbering = Boolean.valueOf(lineNumbering);
  }
  
  public boolean isLineNumbering()
  {
    return (lineNumbering != null) && (lineNumbering.booleanValue());
  }
  
  public boolean isLineNumberingSet()
  {
    return lineNumbering != null;
  }
  
  public void setXMLReader(XMLReader parser)
  {
    this.parser = parser;
    if ((source instanceof SAXSource)) {
      ((SAXSource)source).setXMLReader(parser);
    }
  }
  
  public XMLReader getXMLReader()
  {
    if (parser != null) {
      return parser;
    }
    if ((source instanceof SAXSource)) {
      return ((SAXSource)source).getXMLReader();
    }
    return null;
  }
  
  public void setWrapDocument(Boolean wrap)
  {
    wrapDocument = wrap;
  }
  
  public Boolean getWrapDocument()
  {
    return wrapDocument;
  }
  
  public void setSystemId(String id)
  {
    source.setSystemId(id);
  }
  
  public String getSystemId()
  {
    return source.getSystemId();
  }
  
  public void setXIncludeAware(boolean state)
  {
    xIncludeAware = Boolean.valueOf(state);
  }
  
  public boolean isXIncludeAwareSet()
  {
    return xIncludeAware != null;
  }
  
  public boolean isXIncludeAware()
  {
    return (xIncludeAware != null) && (xIncludeAware.booleanValue());
  }
  
  public void setEntityResolver(EntityResolver resolver)
  {
    entityResolver = resolver;
  }
  
  public EntityResolver getEntityResolver()
  {
    return entityResolver;
  }
  
  public void setErrorListener(ErrorListener listener)
  {
    errorListener = listener;
  }
  
  public ErrorListener getErrorListener()
  {
    return errorListener;
  }
  
  public void setPleaseCloseAfterUse(boolean close)
  {
    pleaseClose = close;
  }
  
  public boolean isPleaseCloseAfterUse()
  {
    return pleaseClose;
  }
  
  public void close()
  {
    try
    {
      if ((source instanceof StreamSource))
      {
        StreamSource ss = (StreamSource)source;
        if (ss.getInputStream() != null) {
          ss.getInputStream().close();
        }
        if (ss.getReader() != null) {
          ss.getReader().close();
        }
      }
      else if ((source instanceof SAXSource))
      {
        InputSource is = ((SAXSource)source).getInputSource();
        if (is != null)
        {
          if (is.getByteStream() != null) {
            is.getByteStream().close();
          }
          if (is.getCharacterStream() != null) {
            is.getCharacterStream().close();
          }
        }
      }
    }
    catch (IOException err) {}
  }
}

/* Location:
 * Qualified Name:     net.sf.saxon.AugmentedSource
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package net.sf.saxon;

import java.io.Serializable;
import net.sf.saxon.expr.XPathContext;
import net.sf.saxon.om.SequenceIterator;
import net.sf.saxon.trans.XPathException;

public abstract interface CollectionURIResolver
  extends Serializable
{
  public abstract SequenceIterator resolve(String paramString1, String paramString2, XPathContext paramXPathContext)
    throws XPathException;
}

/* Location:
 * Qualified Name:     net.sf.saxon.CollectionURIResolver
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package net.sf.saxon;

import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;

class Compile$TracingObjectOutputStream
  extends FilterOutputStream
{
  OutputStream oos;
  
  public Compile$TracingObjectOutputStream(OutputStream oos)
  {
    super(oos);
    this.oos = oos;
  }
  
  public void write(byte[] b)
    throws IOException
  {
    char[] chars = new char[b.length];
    for (int i = 0; i < b.length; i++) {
      chars[i] = ((char)b[i]);
    }
    String s = new String(chars);
    if (s.indexOf("saxon") >= 0) {
      System.err.println("write byte[]: " + s);
    }
    super.write(b);
  }
  
  public void write(byte[] b, int off, int len)
    throws IOException
  {
    char[] chars = new char[len];
    for (int i = 0; i < len; i++) {
      chars[i] = ((char)b[(i + off)]);
    }
    String s = new String(chars);
    if (s.indexOf("saxon") >= 0) {
      System.err.println("write byte[]: " + s);
    }
    super.write(b, off, len);
  }
}

/* Location:
 * Qualified Name:     net.sf.saxon.Compile.TracingObjectOutputStream
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package net.sf.saxon;

import java.io.File;
import java.io.FileOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.URL;
import java.util.Date;
import javax.xml.transform.Source;
import javax.xml.transform.Templates;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.transform.URIResolver;
import javax.xml.transform.sax.SAXSource;
import net.sf.saxon.instruct.Executable;
import net.sf.saxon.instruct.TerminationException;
import net.sf.saxon.trans.XPathException;
import org.xml.sax.InputSource;

public class Compile
{
  private TransformerFactoryImpl factory;
  private boolean showTime;
  private boolean debug;
  
  public Compile()
  {
    factory = new TransformerFactoryImpl();
    
    showTime = false;
    debug = false;
  }
  
  public static void main(String[] args)
    throws Exception
  {
    new Compile().doMain(args);
  }
  
  protected void doMain(String[] args)
  {
    boolean useURLs = false;
    try
    {
      int i = 0;
      for (;;)
      {
        if (i >= args.length) {
          badUsage("No stylesheet file name");
        }
        if (args[i].charAt(0) != '-') {
          break;
        }
        if (args[i].equals("-u"))
        {
          useURLs = true;
          i++;
        }
        else if (args[i].equals("-t"))
        {
          System.err.println(factory.getConfiguration().getProductTitle());
          
          System.err.println(Configuration.getPlatform().getPlatformVersion());
          factory.setAttribute("http://saxon.sf.net/feature/timing", Boolean.TRUE);
          
          showTime = true;
          i++;
        }
        else if (args[i].equals("-y"))
        {
          i++;
          if (args.length < i + 2) {
            badUsage("No style parser class");
          }
          String styleParserName = args[(i++)];
          factory.setAttribute("http://saxon.sf.net/feature/styleParserClass", styleParserName);
        }
        else if (args[i].equals("-r"))
        {
          i++;
          if (args.length < i + 2) {
            badUsage("No URIResolver class");
          }
          String r = args[(i++)];
          factory.setURIResolver(factory.getConfiguration().makeURIResolver(r));
        }
        else if (args[i].equals("-debug"))
        {
          i++;
          debug = true;
        }
        else if (args[i].equals("-1.1"))
        {
          i++;
          factory.setAttribute("http://saxon.sf.net/feature/xml-version", "1.1");
        }
        else
        {
          badUsage("Unknown option " + args[i]);
        }
      }
      if (args.length < i + 1) {
        badUsage("No stylesheet file name");
      }
      String styleFileName = args[(i++)];
      if (args.length < i + 1) {
        badUsage("No output file name");
      }
      String outputFileName = args[(i++)];
      
      long startTime = new Date().getTime();
      Source styleSource;
      if ((useURLs) || (styleFileName.startsWith("http:")) || (styleFileName.startsWith("file:")))
      {
        Source styleSource = factory.getURIResolver().resolve(styleFileName, null);
        if (styleSource == null) {
          styleSource = factory.getConfiguration().getSystemURIResolver().resolve(styleFileName, null);
        }
      }
      else
      {
        File sheetFile = new File(styleFileName);
        if (!sheetFile.exists()) {
          quit("Stylesheet file " + sheetFile + " does not exist", 2);
        }
        InputSource eis = new InputSource(sheetFile.toURL().toString());
        styleSource = new SAXSource(factory.getConfiguration().getStyleParser(), eis);
      }
      if (styleSource == null) {
        quit("URIResolver for stylesheet file must return a Source", 2);
      }
      Templates sheet = factory.newTemplates(styleSource);
      if (showTime)
      {
        long endTime = new Date().getTime();
        System.err.println("Stylesheet compilation time: " + (endTime - startTime) + " milliseconds");
      }
      try
      {
        String msg = ((PreparedStylesheet)sheet).getExecutable().getReasonUnableToCompile();
        if (msg != null)
        {
          System.err.println(msg);
          quit("Unable to compile stylesheet", 2);
        }
        System.err.println("Serializing compiled stylesheet");
        ((PreparedStylesheet)sheet).setTargetNamePool(((PreparedStylesheet)sheet).getConfiguration().getNamePool());
        
        OutputStream fos = new FileOutputStream(outputFileName);
        if (debug) {
          fos = new TracingObjectOutputStream(fos);
        }
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(sheet);
        oos.close();
        System.err.println("Finished serializing stylesheet");
      }
      catch (Exception err)
      {
        err.printStackTrace();
      }
    }
    catch (TerminationException err)
    {
      quit(err.getMessage(), 1);
    }
    catch (XPathException err)
    {
      quit("Stylesheet compilation failed: " + err.getMessage(), 2);
    }
    catch (TransformerConfigurationException err)
    {
      quit("Stylesheet compilation failed: " + err.getMessage(), 2);
    }
    catch (TransformerFactoryConfigurationError err)
    {
      quit("Stylesheet compilation failed: " + err.getMessage(), 2);
    }
    catch (Exception err2)
    {
      err2.printStackTrace();
    }
  }
  
  protected static void quit(String message, int code)
  {
    System.err.println(message);
    System.exit(code);
  }
  
  protected void badUsage(String message)
  {
    System.err.println(message);
    System.err.println(factory.getConfiguration().getProductTitle());
    System.err.println("Usage: java net.sf.saxon.Compile [options] stylesheet-file output-file");
    System.err.println("Options: ");
    System.err.println("  -r classname    Use specified URIResolver class");
    System.err.println("  -t              Display version and timing information");
    System.err.println("  -u              Names are URLs not filenames");
    System.err.println("  -y classname    Use specified SAX parser for stylesheet");
    System.err.println("  -debug          Produce trace output to diagnose failures");
    System.err.println("  -1.1            Allow XML 1.1 documents");
    System.err.println("  -?              Display this message ");
    System.exit(2);
  }
  
  private static class TracingObjectOutputStream
    extends FilterOutputStream
  {
    OutputStream oos;
    
    public TracingObjectOutputStream(OutputStream oos)
    {
      super();
      this.oos = oos;
    }
    
    public void write(byte[] b)
      throws IOException
    {
      char[] chars = new char[b.length];
      for (int i = 0; i < b.length; i++) {
        chars[i] = ((char)b[i]);
      }
      String s = new String(chars);
      if (s.indexOf("saxon") >= 0) {
        System.err.println("write byte[]: " + s);
      }
      super.write(b);
    }
    
    public void write(byte[] b, int off, int len)
      throws IOException
    {
      char[] chars = new char[len];
      for (int i = 0; i < len; i++) {
        chars[i] = ((char)b[(i + off)]);
      }
      String s = new String(chars);
      if (s.indexOf("saxon") >= 0) {
        System.err.println("write byte[]: " + s);
      }
      super.write(b, off, len);
    }
  }
}

/* Location:
 * Qualified Name:     net.sf.saxon.Compile
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package net.sf.saxon;

import java.io.PrintStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.ErrorListener;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.transform.URIResolver;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
import net.sf.saxon.event.Builder;
import net.sf.saxon.event.ContentHandlerProxy;
import net.sf.saxon.event.PipelineConfiguration;
import net.sf.saxon.event.ProxyReceiver;
import net.sf.saxon.event.Receiver;
import net.sf.saxon.event.Sender;
import net.sf.saxon.event.SequenceReceiver;
import net.sf.saxon.event.SerializerFactory;
import net.sf.saxon.event.StandardOutputResolver;
import net.sf.saxon.expr.Optimizer;
import net.sf.saxon.expr.PathMap.PathMapRoot;
import net.sf.saxon.expr.XPathContext;
import net.sf.saxon.functions.ExtensionFunctionFactory;
import net.sf.saxon.functions.FunctionLibrary;
import net.sf.saxon.functions.StandardCollectionURIResolver;
import net.sf.saxon.functions.VendorFunctionLibrary;
import net.sf.saxon.instruct.Debugger;
import net.sf.saxon.instruct.SlotManager;
import net.sf.saxon.java.JavaPlatform;
import net.sf.saxon.om.DocumentInfo;
import net.sf.saxon.om.DocumentNumberAllocator;
import net.sf.saxon.om.DocumentPool;
import net.sf.saxon.om.ExternalObjectModel;
import net.sf.saxon.om.Name10Checker;
import net.sf.saxon.om.Name11Checker;
import net.sf.saxon.om.NameChecker;
import net.sf.saxon.om.NamePool;
import net.sf.saxon.om.NodeInfo;
import net.sf.saxon.pull.PullProvider;
import net.sf.saxon.pull.PullSource;
import net.sf.saxon.query.ModuleURIResolver;
import net.sf.saxon.query.StandardModuleURIResolver;
import net.sf.saxon.sort.CollationURIResolver;
import net.sf.saxon.sort.StandardCollationURIResolver;
import net.sf.saxon.sort.StringCollator;
import net.sf.saxon.sxpath.IndependentContext;
import net.sf.saxon.tinytree.TinyBuilder;
import net.sf.saxon.trace.TraceListener;
import net.sf.saxon.trans.XPathException;
import net.sf.saxon.tree.TreeBuilder;
import net.sf.saxon.type.BuiltInListType;
import net.sf.saxon.type.BuiltInType;
import net.sf.saxon.type.SchemaDeclaration;
import net.sf.saxon.type.SchemaException;
import net.sf.saxon.type.SchemaType;
import net.sf.saxon.type.SchemaURIResolver;
import net.sf.saxon.type.TypeHierarchy;
import net.sf.saxon.type.ValidationException;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.XMLReader;

public class Configuration
  implements Serializable, SourceResolver
{
  private StandardURIResolver systemURIResolver = new StandardURIResolver(this);
  private int xmlVersion = 10;
  private int treeModel = 1;
  private boolean lineNumbering = false;
  private boolean tracing = false;
  private boolean traceOptimizations = false;
  private transient TraceListener traceListener = null;
  private CollationURIResolver collationResolver = StandardCollationURIResolver.getInstance();
  private CollectionURIResolver collectionResolver = new StandardCollectionURIResolver();
  private ModuleURIResolver moduleURIResolver = null;
  private ModuleURIResolver standardModuleURIResolver = StandardModuleURIResolver.getInstance();
  private SchemaURIResolver schemaURIResolver = null;
  private transient SourceResolver sourceResolver = this;
  protected int recoveryPolicy = 1;
  private String messageEmitterClass = "net.sf.saxon.event.MessageEmitter";
  private boolean timing = false;
  private boolean versionWarning = true;
  private boolean allowExternalFunctions = true;
  private boolean traceExternalFunctions = false;
  private boolean validation = false;
  private boolean allNodesUntyped = false;
  private boolean lazyConstructionMode = false;
  private boolean allowMultiThreading = false;
  private boolean preEvaluateDocFunction = false;
  private int stripsWhiteSpace = 1;
  private boolean xIncludeAware = false;
  private boolean useDisableOutputEscaping = false;
  private NamePool namePool = null;
  private DocumentNumberAllocator documentNumberAllocator = new DocumentNumberAllocator();
  private DocumentPool globalDocumentPool = new DocumentPool();
  private transient XPathContext conversionContext = null;
  private int hostLanguage = 50;
  private int schemaValidationMode = 3;
  private boolean validationWarnings = false;
  private boolean expandDefaultAttributes = true;
  private boolean retainDTDattributeTypes = false;
  private transient Debugger debugger = null;
  protected Optimizer optimizer = null;
  private SerializerFactory serializerFactory = new SerializerFactory();
  private transient List sourceParserPool = new ArrayList(5);
  private transient List styleParserPool = new ArrayList(5);
  private static List sharedExternalObjectModels = null;
  private List externalObjectModels = null;
  private int domLevel = 3;
  private static Platform platform = JavaPlatform.getInstance();
  private transient URIResolver uriResolver;
  protected transient ErrorListener listener;
  private FunctionLibrary javaExtensionBinder;
  private FunctionLibrary dotNetExtensionBinder;
  private transient ExtensionFunctionFactory javaExtensionFunctionFactory;
  private transient ExtensionFunctionFactory dotNetExtensionFunctionFactory;
  protected VendorFunctionLibrary vendorFunctionLibrary;
  private String sourceParserClass;
  private String styleParserClass;
  private transient OutputURIResolver outputURIResolver;
  private transient TypeHierarchy typeHierarchy;
  private transient ClassLoader classLoader;
  public static final int RECOVER_SILENTLY = 0;
  public static final int RECOVER_WITH_WARNINGS = 1;
  public static final int DO_NOT_RECOVER = 2;
  public static final int XML10 = 10;
  public static final int XML11 = 11;
  public static final int XSLT = 50;
  public static final int XQUERY = 51;
  public static final int XML_SCHEMA = 52;
  public static final int JAVA_APPLICATION = 53;
  public static final int XPATH = 54;
  
  public Configuration()
  {
    init();
  }
  
  public static Configuration makeConfiguration(ClassLoader classLoader, String className)
  {
    try
    {
      Configuration c = makeSchemaAwareConfiguration(classLoader, className);
      if (c.isSchemaAware(52)) {
        return c;
      }
      return new Configuration();
    }
    catch (RuntimeException err) {}
    return new Configuration();
  }
  
  protected void init()
  {
    BuiltInListType.init();
    platform.initialize(this);
    if (platform.isDotNet()) {
      externalObjectModels = Collections.EMPTY_LIST;
    } else {
      synchronized (Configuration.class)
      {
        if (sharedExternalObjectModels == null) {
          registerStandardObjectModels();
        }
        externalObjectModels = new ArrayList(sharedExternalObjectModels);
      }
    }
    namePool = new NamePool();
    platform.makeExtensionLibrary(this);
  }
  
  public static Configuration makeSchemaAwareConfiguration(ClassLoader classLoader, String className)
    throws RuntimeException
  {
    if (className == null) {
      className = "com.saxonica.validate.SchemaAwareConfiguration";
    }
    try
    {
      ClassLoader loader = classLoader;
      if (loader == null) {
        try
        {
          loader = Thread.currentThread().getContextClassLoader();
        }
        catch (Exception err)
        {
          System.err.println("Failed to getContextClassLoader() - continuing");
        }
      }
      Class theClass;
      if (loader != null) {
        try
        {
          theClass = loader.loadClass(className);
        }
        catch (Exception ex)
        {
          Class theClass = Class.forName(className);
        }
      } else {
        theClass = Class.forName(className);
      }
      return (Configuration)theClass.newInstance();
    }
    catch (ClassNotFoundException e)
    {
      throw new RuntimeException(e);
    }
    catch (InstantiationException e)
    {
      throw new RuntimeException(e);
    }
    catch (IllegalAccessException e)
    {
      throw new RuntimeException(e);
    }
  }
  
  public Configuration copy()
  {
    Configuration c = new Configuration();
    copyTo(c);
    return c;
  }
  
  protected void copyTo(Configuration c)
  {
    uriResolver = uriResolver;
    systemURIResolver = systemURIResolver;
    listener = listener;
    xmlVersion = xmlVersion;
    treeModel = treeModel;
    lineNumbering = lineNumbering;
    tracing = tracing;
    traceOptimizations = traceOptimizations;
    traceListener = traceListener;
    javaExtensionBinder = javaExtensionBinder;
    dotNetExtensionBinder = dotNetExtensionBinder;
    javaExtensionFunctionFactory = javaExtensionFunctionFactory;
    dotNetExtensionFunctionFactory = dotNetExtensionFunctionFactory;
    collationResolver = collationResolver;
    collectionResolver = collectionResolver;
    moduleURIResolver = moduleURIResolver;
    standardModuleURIResolver = standardModuleURIResolver;
    schemaURIResolver = schemaURIResolver;
    sourceResolver = sourceResolver;
    vendorFunctionLibrary = vendorFunctionLibrary;
    recoveryPolicy = recoveryPolicy;
    messageEmitterClass = messageEmitterClass;
    sourceParserClass = sourceParserClass;
    styleParserClass = styleParserClass;
    outputURIResolver = outputURIResolver;
    timing = timing;
    versionWarning = versionWarning;
    allowExternalFunctions = allowExternalFunctions;
    validation = validation;
    allNodesUntyped = allNodesUntyped;
    lazyConstructionMode = lazyConstructionMode;
    allowMultiThreading = allowMultiThreading;
    preEvaluateDocFunction = preEvaluateDocFunction;
    stripsWhiteSpace = stripsWhiteSpace;
    xIncludeAware = xIncludeAware;
    namePool = namePool;
    documentNumberAllocator = documentNumberAllocator;
    conversionContext = conversionContext;
    typeHierarchy = typeHierarchy;
    hostLanguage = hostLanguage;
    schemaValidationMode = schemaValidationMode;
    validationWarnings = validationWarnings;
    expandDefaultAttributes = expandDefaultAttributes;
    retainDTDattributeTypes = retainDTDattributeTypes;
    debugger = debugger;
    optimizer = optimizer;
    serializerFactory = serializerFactory;
    classLoader = classLoader;
    sourceParserPool = sourceParserPool;
    externalObjectModels = externalObjectModels;
    domLevel = domLevel;
  }
  
  public String getProductTitle()
  {
    return "Saxon " + Version.getProductVersion() + platform.getPlatformSuffix() + " from Saxonica";
  }
  
  public boolean isSchemaAware(int language)
  {
    return false;
  }
  
  public void displayLicenseMessage() {}
  
  public int getHostLanguage()
  {
    return hostLanguage;
  }
  
  public void setHostLanguage(int hostLanguage)
  {
    this.hostLanguage = hostLanguage;
  }
  
  public static Platform getPlatform()
  {
    return platform;
  }
  
  public URIResolver getURIResolver()
  {
    if (uriResolver == null) {
      return systemURIResolver;
    }
    return uriResolver;
  }
  
  public void setURIResolver(URIResolver resolver)
  {
    uriResolver = resolver;
    if ((resolver instanceof StandardURIResolver)) {
      ((StandardURIResolver)resolver).setConfiguration(this);
    }
  }
  
  public void setParameterizedURIResolver()
  {
    getSystemURIResolver().setRecognizeQueryParameters(true);
  }
  
  public StandardURIResolver getSystemURIResolver()
  {
    return systemURIResolver;
  }
  
  public URIResolver makeURIResolver(String className)
    throws TransformerException
  {
    Object obj = getInstance(className, null);
    if ((obj instanceof StandardURIResolver)) {
      ((StandardURIResolver)obj).setConfiguration(this);
    }
    if ((obj instanceof URIResolver)) {
      return (URIResolver)obj;
    }
    throw new XPathException("Class " + className + " is not a URIResolver");
  }
  
  public ErrorListener getErrorListener()
  {
    if (listener == null)
    {
      listener = new StandardErrorListener();
      ((StandardErrorListener)listener).setRecoveryPolicy(recoveryPolicy);
    }
    return listener;
  }
  
  public void setErrorListener(ErrorListener listener)
  {
    this.listener = listener;
  }
  
  public void reportFatalError(XPathException err)
  {
    if (!err.hasBeenReported())
    {
      try
      {
        getErrorListener().fatalError(err);
      }
      catch (TransformerException e) {}
      err.setHasBeenReported();
    }
  }
  
  public void setMultiThreading(boolean multithreading)
  {
    allowMultiThreading = multithreading;
  }
  
  public boolean isMultiThreading()
  {
    return allowMultiThreading;
  }
  
  public void setXMLVersion(int version)
  {
    xmlVersion = version;
  }
  
  public int getXMLVersion()
  {
    return xmlVersion;
  }
  
  public NameChecker getNameChecker()
  {
    return xmlVersion == 10 ? Name10Checker.getInstance() : Name11Checker.getInstance();
  }
  
  public XPathContext getConversionContext()
  {
    if (conversionContext == null) {
      conversionContext = new IndependentContext(this).makeEarlyEvaluationContext();
    }
    return conversionContext;
  }
  
  public int getTreeModel()
  {
    return treeModel;
  }
  
  public void setTreeModel(int treeModel)
  {
    this.treeModel = treeModel;
  }
  
  public boolean isLineNumbering()
  {
    return lineNumbering;
  }
  
  public void setLineNumbering(boolean lineNumbering)
  {
    this.lineNumbering = lineNumbering;
  }
  
  public void setXIncludeAware(boolean state)
  {
    xIncludeAware = state;
  }
  
  public boolean isXIncludeAware()
  {
    return xIncludeAware;
  }
  
  public TraceListener getTraceListener()
  {
    return traceListener;
  }
  
  public void setTraceListener(TraceListener traceListener)
  {
    this.traceListener = traceListener;
    setCompileWithTracing(true);
    setMultiThreading(false);
  }
  
  public boolean isCompileWithTracing()
  {
    return tracing;
  }
  
  public void setCompileWithTracing(boolean trace)
  {
    tracing = trace;
  }
  
  public void setOptimizerTracing(boolean trace)
  {
    traceOptimizations = trace;
  }
  
  public boolean isOptimizerTracing()
  {
    return traceOptimizations;
  }
  
  public TraceListener makeTraceListener(String className)
    throws XPathException
  {
    Object obj = getInstance(className, null);
    if ((obj instanceof TraceListener)) {
      return (TraceListener)obj;
    }
    throw new XPathException("Class " + className + " is not a TraceListener");
  }
  
  public void setExtensionBinder(String scheme, FunctionLibrary binder)
  {
    if (scheme.equals("java")) {
      javaExtensionBinder = binder;
    } else if (scheme.equals("clitype")) {
      dotNetExtensionBinder = binder;
    } else {
      throw new IllegalArgumentException("Unknown scheme " + scheme + " - must be java or clitype");
    }
  }
  
  public FunctionLibrary getExtensionBinder(String scheme)
  {
    if (scheme.equals("java")) {
      return javaExtensionBinder;
    }
    if (scheme.equals("clitype")) {
      return dotNetExtensionBinder;
    }
    throw new IllegalArgumentException("Unknown scheme " + scheme + " - must be java or clitype");
  }
  
  public VendorFunctionLibrary getVendorFunctionLibrary()
  {
    if (vendorFunctionLibrary == null) {
      vendorFunctionLibrary = new VendorFunctionLibrary();
    }
    return vendorFunctionLibrary;
  }
  
  public void setCollationURIResolver(CollationURIResolver resolver)
  {
    collationResolver = resolver;
  }
  
  public CollationURIResolver getCollationURIResolver()
  {
    return collationResolver;
  }
  
  public void setCollectionURIResolver(CollectionURIResolver resolver)
  {
    collectionResolver = resolver;
  }
  
  public CollectionURIResolver getCollectionURIResolver()
  {
    return collectionResolver;
  }
  
  public void setModuleURIResolver(ModuleURIResolver resolver)
  {
    moduleURIResolver = resolver;
  }
  
  public void setModuleURIResolver(String className)
    throws TransformerException
  {
    Object obj = getInstance(className, null);
    if ((obj instanceof ModuleURIResolver)) {
      setModuleURIResolver((ModuleURIResolver)obj);
    } else {
      throw new XPathException("Class " + className + " is not a LocationHintResolver");
    }
  }
  
  public ModuleURIResolver getModuleURIResolver()
  {
    return moduleURIResolver;
  }
  
  public ModuleURIResolver getStandardModuleURIResolver()
  {
    return standardModuleURIResolver;
  }
  
  public void setSchemaURIResolver(SchemaURIResolver resolver)
  {
    schemaURIResolver = resolver;
  }
  
  public SchemaURIResolver getSchemaURIResolver()
  {
    return schemaURIResolver;
  }
  
  public int getRecoveryPolicy()
  {
    return recoveryPolicy;
  }
  
  public void setRecoveryPolicy(int recoveryPolicy)
  {
    this.recoveryPolicy = recoveryPolicy;
  }
  
  public String getMessageEmitterClass()
  {
    return messageEmitterClass;
  }
  
  public void setMessageEmitterClass(String messageEmitterClass)
  {
    this.messageEmitterClass = messageEmitterClass;
  }
  
  public String getSourceParserClass()
  {
    return sourceParserClass;
  }
  
  public void setSourceParserClass(String sourceParserClass)
  {
    this.sourceParserClass = sourceParserClass;
  }
  
  public String getStyleParserClass()
  {
    return styleParserClass;
  }
  
  public void setStyleParserClass(String styleParserClass)
  {
    this.styleParserClass = styleParserClass;
  }
  
  public OutputURIResolver getOutputURIResolver()
  {
    if (outputURIResolver == null) {
      outputURIResolver = StandardOutputResolver.getInstance();
    }
    return outputURIResolver;
  }
  
  public void setOutputURIResolver(OutputURIResolver outputURIResolver)
  {
    this.outputURIResolver = outputURIResolver;
  }
  
  public void setSerializerFactory(SerializerFactory factory)
  {
    serializerFactory = factory;
  }
  
  public SerializerFactory getSerializerFactory()
  {
    return serializerFactory;
  }
  
  public boolean isTiming()
  {
    return timing;
  }
  
  public void setTiming(boolean timing)
  {
    this.timing = timing;
  }
  
  public boolean isVersionWarning()
  {
    return versionWarning;
  }
  
  public void setVersionWarning(boolean warn)
  {
    versionWarning = warn;
  }
  
  public boolean isAllowExternalFunctions()
  {
    return allowExternalFunctions;
  }
  
  public void setAllowExternalFunctions(boolean allowExternalFunctions)
  {
    this.allowExternalFunctions = allowExternalFunctions;
  }
  
  public boolean isTraceExternalFunctions()
  {
    return traceExternalFunctions;
  }
  
  public void setRetainDTDAttributeTypes(boolean useTypes)
    throws TransformerFactoryConfigurationError
  {
    if ((useTypes) && (!isSchemaAware(52))) {
      throw new TransformerFactoryConfigurationError("Retaining DTD attribute types requires the schema-aware product");
    }
    retainDTDattributeTypes = useTypes;
  }
  
  public boolean isRetainDTDAttributeTypes()
  {
    return retainDTDattributeTypes;
  }
  
  public void setTraceExternalFunctions(boolean traceExternalFunctions)
  {
    this.traceExternalFunctions = traceExternalFunctions;
  }
  
  public ExtensionFunctionFactory getExtensionFunctionFactory(String scheme)
  {
    if ("java".equals(scheme)) {
      return javaExtensionFunctionFactory;
    }
    if ("clitype".equals(scheme)) {
      return dotNetExtensionFunctionFactory;
    }
    throw new IllegalArgumentException("Unknown extension function scheme");
  }
  
  public void setExtensionFunctionFactory(String scheme, ExtensionFunctionFactory factory)
  {
    if ("java".equals(scheme)) {
      javaExtensionFunctionFactory = factory;
    } else if ("clitype".equals(scheme)) {
      dotNetExtensionFunctionFactory = factory;
    } else {
      throw new IllegalArgumentException("Unknown extension function scheme");
    }
  }
  
  public boolean isValidation()
  {
    return validation;
  }
  
  public void setValidation(boolean validation)
  {
    this.validation = validation;
  }
  
  public void setAllNodesUntyped(boolean allUntyped)
  {
    allNodesUntyped = allUntyped;
  }
  
  public boolean areAllNodesUntyped()
  {
    return allNodesUntyped;
  }
  
  public ProxyReceiver makeDocumentProjector(PathMap.PathMapRoot map)
  {
    throw new UnsupportedOperationException("Document projection requires a schema-aware Configuration");
  }
  
  public int getSchemaValidationMode()
  {
    return schemaValidationMode;
  }
  
  public void setSchemaValidationMode(int validationMode)
  {
    switch (validationMode)
    {
    case 3: 
    case 4: 
      break;
    case 1: 
    case 2: 
      if (!isSchemaAware(52)) {
        needSchemaAwareVersion();
      }
      break;
    default: 
      throw new IllegalArgumentException("Unsupported validation mode " + validationMode);
    }
    schemaValidationMode = validationMode;
  }
  
  public void setValidationWarnings(boolean warn)
  {
    validationWarnings = warn;
  }
  
  public boolean isValidationWarnings()
  {
    return validationWarnings;
  }
  
  public void setExpandAttributeDefaults(boolean expand)
  {
    expandDefaultAttributes = expand;
  }
  
  public boolean isExpandAttributeDefaults()
  {
    return expandDefaultAttributes;
  }
  
  public NamePool getNamePool()
  {
    return namePool;
  }
  
  public void setNamePool(NamePool targetNamePool)
  {
    namePool = targetNamePool;
  }
  
  public final TypeHierarchy getTypeHierarchy()
  {
    if (typeHierarchy == null) {
      typeHierarchy = new TypeHierarchy(this);
    }
    return typeHierarchy;
  }
  
  public DocumentNumberAllocator getDocumentNumberAllocator()
  {
    return documentNumberAllocator;
  }
  
  public void setDocumentNumberAllocator(DocumentNumberAllocator allocator)
  {
    documentNumberAllocator = allocator;
  }
  
  public boolean isCompatible(Configuration other)
  {
    return (namePool == namePool) && (documentNumberAllocator == documentNumberAllocator);
  }
  
  public DocumentPool getGlobalDocumentPool()
  {
    return globalDocumentPool;
  }
  
  public boolean isStripsAllWhiteSpace()
  {
    return stripsWhiteSpace == 2;
  }
  
  public void setStripsAllWhiteSpace(boolean stripsAllWhiteSpace)
  {
    if (stripsAllWhiteSpace) {
      stripsWhiteSpace = 2;
    }
  }
  
  public void setStripsWhiteSpace(int kind)
  {
    stripsWhiteSpace = kind;
  }
  
  public int getStripsWhiteSpace()
  {
    return stripsWhiteSpace;
  }
  
  public synchronized XMLReader getSourceParser()
    throws TransformerFactoryConfigurationError
  {
    if (sourceParserPool == null) {
      sourceParserPool = new ArrayList(10);
    }
    if (!sourceParserPool.isEmpty())
    {
      int n = sourceParserPool.size() - 1;
      XMLReader parser = (XMLReader)sourceParserPool.get(n);
      sourceParserPool.remove(n);
      return parser;
    }
    XMLReader parser;
    XMLReader parser;
    if (getSourceParserClass() != null) {
      parser = makeParser(getSourceParserClass());
    } else {
      parser = loadParser();
    }
    try
    {
      Sender.configureParser(parser);
    }
    catch (XPathException err)
    {
      throw new TransformerFactoryConfigurationError(err);
    }
    if (isValidation()) {
      try
      {
        parser.setFeature("http://xml.org/sax/features/validation", true);
      }
      catch (SAXException err)
      {
        throw new TransformerFactoryConfigurationError("The XML parser does not support validation");
      }
    }
    return parser;
  }
  
  public synchronized void reuseSourceParser(XMLReader parser)
  {
    if (sourceParserPool == null) {
      sourceParserPool = new ArrayList(10);
    }
    try
    {
      parser.setContentHandler(null);
      parser.setEntityResolver(null);
      parser.setDTDHandler(null);
      parser.setErrorHandler(null);
    }
    catch (Exception err) {}
    sourceParserPool.add(parser);
  }
  
  private XMLReader loadParser()
  {
    XMLReader parser;
    try
    {
      parser = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
    }
    catch (ParserConfigurationException err)
    {
      throw new TransformerFactoryConfigurationError(err);
    }
    catch (SAXException err)
    {
      throw new TransformerFactoryConfigurationError(err);
    }
    return parser;
  }
  
  public synchronized XMLReader getStyleParser()
    throws TransformerFactoryConfigurationError
  {
    if (styleParserPool == null) {
      styleParserPool = new ArrayList(10);
    }
    if (!styleParserPool.isEmpty())
    {
      int n = styleParserPool.size() - 1;
      XMLReader parser = (XMLReader)styleParserPool.get(n);
      styleParserPool.remove
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd