Package com.agilejava.docbkx.maven

Examples of com.agilejava.docbkx.maven.PreprocessingFilter


        final XMLReader reader = factory.newSAXParser().getXMLReader();
        // configure XML reader
        reader.setEntityResolver(resolver);
        // eval PI
        final PreprocessingFilter filter = createPIHandler(resolver, reader);
        // configure SAXSource for XInclude
        final Source xmlSource = createSource(inputFilename, sourceFile, filter, map);

        // XSL Transformation
        final Transformer transformer = builder.build();
View Full Code Here


   * @param resolver The initial resolver to use.
   * @param reader   The source XML reader.
   * @return The XML PI filter.
   */
  private PreprocessingFilter createPIHandler(EntityResolver resolver, XMLReader reader) {
    PreprocessingFilter filter = new PreprocessingFilter(reader);
    ProcessingInstructionHandler resolvingHandler = new ExpressionHandler(new VariableResolver() {

      public Object resolveVariable(String name) throws ELException {
        if ("date".equals(name)) {
          return DateFormat.getDateInstance(DateFormat.LONG).format(new Date());
        } else if ("project".equals(name)) {
          return getProject();
        } else {
          return getProject().getProperties().get(name);
        }
      }

    }, getLog());
    filter.setHandlers(Arrays.asList(new Object[] { resolvingHandler }));
    filter.setEntityResolver(resolver);
    return filter;
  }
View Full Code Here

TOP

Related Classes of com.agilejava.docbkx.maven.PreprocessingFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.