Example #1
0
  /** Recycle this component. All instance variables are set to <code>null</code>. */
  public void recycle() {
    if (inputSource != null) super.resolver.release(inputSource);

    inputSource = null;
    encoding = null;
    nonXmlChars = null;

    super.recycle();
  }
Example #2
0
  /**
   * Set the SourceResolver, objectModel Map, the source and sitemap Parameters used to process the
   * request.
   *
   * @param resolver Source resolver
   * @param objectmodel Object model
   * @param src Source
   * @param parameters Parameters
   * @throws IOException
   * @throws ProcessingException
   * @throws SAXException
   */
  public void setup(SourceResolver resolver, Map objectmodel, String src, Parameters parameters)
      throws ProcessingException, SAXException, IOException {
    super.setup(resolver, objectmodel, src, parameters);
    try {
      this.encoding = parameters.getParameter("encoding", null);
      this.inputSource = resolver.resolveURI(src);

      String nXmlCh = parameters.getParameter("nonXmlChars", String.valueOf(initNonXmlChars));
      if (nXmlCh.length() != initNonXmlChars.length)
        throw new ProcessingException(
            "Error during resolving of '" + src + "'.",
            new SourceException(
                "length of attribute string 'nonXmlChars' is "
                    + nXmlCh.length()
                    + " where it should be "
                    + initNonXmlChars.length
                    + "!"));

      this.nonXmlChars = nXmlCh.toCharArray();
    } catch (SourceException se) {
      throw new ProcessingException("Error during resolving of '" + src + "'.", se);
    }
  }