edu.ucsb.nceas.metacat
Class DBTransform

java.lang.Object
  |
  +--edu.ucsb.nceas.metacat.DBTransform

public class DBTransform
extends java.lang.Object

A Class that transforms XML documents utitlizing XSL style sheets


Constructor Summary
DBTransform()
          construct a DBTransform instance.
 
Method Summary
static org.w3c.dom.NodeList getPathContent(java.io.File f, java.lang.String path)
          gets the content of a tag in a given xml file with the given path
 java.lang.String getStyleSystemId(java.lang.String qformat, java.lang.String sourcetype, java.lang.String targettype)
          Lookup a stylesheet reference from the db catalog
 java.lang.String getSystemId(java.lang.String objecttype, java.lang.String sourcetype, java.lang.String targettype)
          Lookup a stylesheet reference from the db catalog
static void main(java.lang.String[] args)
          the main routine used to test the transform utility.
 void transformXMLDocument(java.lang.String doc, java.lang.String sourceType, java.lang.String targetType, java.lang.String qformat, java.io.PrintWriter pw)
          Transform an XML document using the stylesheet reference from the db
 void transformXMLDocument(java.lang.String doc, java.lang.String sourceType, java.lang.String targetType, java.lang.String qFormat, java.io.StringWriter pw)
          Transform an XML document to StringWriter using the stylesheet reference from the db
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBTransform

public DBTransform()
            throws java.io.IOException,
                   java.sql.SQLException,
                   java.lang.ClassNotFoundException
construct a DBTransform instance. Generally, one calls transformXMLDocument() after constructing the instance
Parameters:
conn - the database connection from which to lookup the public ids
Method Detail

transformXMLDocument

public void transformXMLDocument(java.lang.String doc,
                                 java.lang.String sourceType,
                                 java.lang.String targetType,
                                 java.lang.String qformat,
                                 java.io.PrintWriter pw)
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

transformXMLDocument

public void transformXMLDocument(java.lang.String doc,
                                 java.lang.String sourceType,
                                 java.lang.String targetType,
                                 java.lang.String qFormat,
                                 java.io.StringWriter pw)
Transform an XML document to StringWriter 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 StringWriter to which output will be stored

getPathContent

public static org.w3c.dom.NodeList getPathContent(java.io.File f,
                                                  java.lang.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

getStyleSystemId

public java.lang.String getStyleSystemId(java.lang.String qformat,
                                         java.lang.String sourcetype,
                                         java.lang.String targettype)
Lookup a stylesheet reference from the db catalog
Parameters:
qformat - the named style-set format
sourcetype - the document type of the source
targettype - the document type of the target

getSystemId

public java.lang.String getSystemId(java.lang.String objecttype,
                                    java.lang.String sourcetype,
                                    java.lang.String targettype)
Lookup a stylesheet reference from the db catalog
Parameters:
objecttype - the type of the object we want to retrieve
sourcetype - the document type of the source
targettype - the document type of the target

main

public static void main(java.lang.String[] args)
the main routine used to test the transform utility. Usage: java DBTransform


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.