Class XmlTransformer

java.lang.Object
org.apache.commons.io.DirectoryWalker<File>
org.forgerock.doc.maven.utils.XmlTransformer
Direct Known Subclasses:
ImageDataTransformer, KeepTogetherTransformer, TheadRowTransformer

public class XmlTransformer extends org.apache.commons.io.DirectoryWalker<File>
Apply and XSL transformation to DocBook XML files.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.commons.io.DirectoryWalker

    org.apache.commons.io.DirectoryWalker.CancelException
  • Constructor Summary

    Constructors
    Constructor
    Description
    XmlTransformer(FileFilter filterToMatch, String xslResource)
    Construct an updater to match DocBook XML files.
    XmlTransformer(String xsl, FileFilter filterToMatch)
    Construct an updater to match DocBook XML files.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected final void
    handleFile(File file, int depth, Collection<File> results)
    Update files that match, adding them to the results.
    final List<File>
    update(File startDirectory)
    Update files that match the filter.

    Methods inherited from class org.apache.commons.io.DirectoryWalker

    checkIfCancelled, filterDirectoryContents, handleCancelled, handleDirectory, handleDirectoryEnd, handleDirectoryStart, handleEnd, handleIsCancelled, handleRestricted, handleStart, walk

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • XmlTransformer

      public XmlTransformer(FileFilter filterToMatch, String xslResource)
      Construct an updater to match DocBook XML files.

      The files are updated in place.

      The XSL resource must be on the classpath, and so you probably want to extend this with your own transformer class.

      Parameters:
      filterToMatch - Filter to match XML files.
      xslResource - Path to XSL resource.
    • XmlTransformer

      public XmlTransformer(String xsl, FileFilter filterToMatch)
      Construct an updater to match DocBook XML files.

      The files are updated in place.

      Parameters:
      filterToMatch - Filter to match XML files.
      xsl - XSL as string.
  • Method Details

    • update

      public final List<File> update(File startDirectory) throws IOException
      Update files that match the filter.
      Parameters:
      startDirectory - Base directory under which to update files, recursively
      Returns:
      List of updated files
      Throws:
      IOException - Something went wrong changing a file's content.
    • handleFile

      protected final void handleFile(File file, int depth, Collection<File> results) throws IOException
      Update files that match, adding them to the results.
      Overrides:
      handleFile in class org.apache.commons.io.DirectoryWalker<File>
      Parameters:
      file - File to update
      depth - Not used
      results - List of files updated
      Throws:
      IOException - Something went wrong changing a file's content.