net.sf.saxon.lib

## Class StandardOutputResolver

- java.lang.Object
- - net.sf.saxon.lib.StandardOutputResolver

- All Implemented Interfaces:
    Serializable, OutputURIResolver

      public class StandardOutputResolver
      extends Object
      implements OutputURIResolver, Serializable

  This class defines the default OutputURIResolver. This is a counterpart to the JAXP URIResolver, but is used to map the URI of a secondary result document to a Result object which acts as the destination for the new document.
  Author:
    Michael H. Kay
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StandardOutputResolver()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close(Result result)` Signal completion of the result document.
    `static StandardOutputResolver` | `getInstance()` Get a singular instance
    `static Result` | `makeOutputFile(URI absoluteURI)` Create an output file (unless it already exists) and return a reference to it as a Result object
    `StandardOutputResolver` | `newInstance()` Get an instance of this OutputURIResolver class.
    `Result` | `resolve(String href, String base)` Resolve an output URI

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StandardOutputResolver

          public StandardOutputResolver()

  - ### Method Detail

    - #### getInstance

          public static StandardOutputResolver getInstance()

      Get a singular instance
      Returns:
        the singleton instance of the class

    - #### newInstance

          public StandardOutputResolver newInstance()

      Get an instance of this OutputURIResolver class.

      This method is called every time an xsl:result-document instruction is evaluated (with an href attribute). The resolve() and close() methods will be called on the returned instance.

      This OutputURIResolver is stateless (that is, it retains no information between resolve() and close()), so the same instance can safely be returned each time. For a stateful OutputURIResolver, it must either take care to be thread-safe (handling multiple invocations of xsl:result-document concurrently), or it must return a fresh instance of itself for each call.

      Specified by:
        `newInstance` in interface `OutputURIResolver`

    - #### resolve

          public Result resolve(String href,
                       String base)
                         throws XPathException

      Resolve an output URI
      Specified by:
        `resolve` in interface `OutputURIResolver`
      Parameters:
        `href` - The relative URI of the output document. This corresponds to the href attribute of the xsl:result-document instruction.
        `base` - The base URI that should be used. This is the base output URI, normally the URI of the principal output file.
      Returns:
        a Result object representing the destination for the XML document
      Throws:
        `XPathException`

    - #### makeOutputFile

          public static Result makeOutputFile(URI absoluteURI)
                                       throws XPathException

      Create an output file (unless it already exists) and return a reference to it as a Result object
      Parameters:
        `absoluteURI` - the URI of the output file (which should use the "file" scheme
      Returns:
        a Result object referencing this output file
      Throws:
        `XPathException`

    - #### close

          public void close(Result result)
                     throws XPathException

      Signal completion of the result document. This method is called by the system when the result document has been successfully written. It allows the resolver to perform tidy-up actions such as closing output streams, or firing off processes that take this result tree as input. Note that the OutputURIResolver is stateless, so the original href is supplied to identify the document that has been completed.
      Specified by:
        `close` in interface `OutputURIResolver`
      Parameters:
        `result` - The result object returned by the previous call of resolve()
      Throws:
        `XPathException`

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.