Class DBTransform

java.lang.Object
edu.ucsb.nceas.metacat.DBTransform

public class DBTransform extends Object
A Class that transforms XML documents utitlizing XSL style sheets Building a transformer from the .xsl is expensive, so Templates are used as an intermediate construct to allow lightweight construction of Transformers. (Transformers themselves are not thread safe, so can't be reused)
  • Constructor Details

  • Method Details

    • getTransformer

      protected static Transformer getTransformer(String xslSystemId) throws TransformerConfigurationException
      The method that manages the Templates Map instances that will be used to build transformers from.
      Parameters:
      xslSystemId - - the URL for the stylesheet
      forceRebuild - - if true, forces reload of the stylesheet from the system, else use the existing one, if there
      Returns:
      Throws:
      TransformerConfigurationException
    • transformXMLDocument

      public void transformXMLDocument(String doc, String sourceType, String targetType, String qformat, Writer w, Hashtable<String,String[]> param, String sessionid)
      Transform an XML document using the stylesheet reference from the db
      Parameters:
      doc - the document to be transformed
      sourcetype - the document type of the source
      targettype - the target document type
      qformat - the name of the style set to use
      pw - the PrintWriter to which output is printed
      params - some parameters for eml2 transformation
    • doTransform

      protected void doTransform(StreamSource xml, StreamResult resultOutput, Transformer transformer, Hashtable<String,String[]> param, String qformat, String sessionid) throws edu.ucsb.nceas.utilities.PropertyNotFoundException, TransformerException
      Reads skin's config file if it exists, and populates Transformer paramaters with its contents. It then adds the parameters passed to it via Hashtable param to the Transformer. It then calls the Transformer.transform method.
      Throws:
      edu.ucsb.nceas.utilities.PropertyNotFoundException
      TransformerException
    • getPathContent

      public static NodeList getPathContent(File f, String path)
      gets the content of a tag in a given xml file with the given path
      Parameters:
      f - the file to parse
      path - the path to get the content from
    • setForceRebuild

      public static void setForceRebuild(boolean forceBuild)
      Set the field of forceRebuild
      Parameters:
      forceRebuild -