|
Devsphere.com |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.devsphere.examples.xml.saxdomix.TransformerRunner
This class is a generic launcher for Transformers.
The class that uses TransformerRunner must be a subclasses
of Transformer, it must have a constructor that accepts only
String parameters and it must call run()
passing as parameters the full class name, the command line arguments
and the names of the command line arguments that correspond to the
constructor's parameters.
Usage Example:
import com.devsphere.xml.saxdomix.SDXTransformer;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.stream.StreamSource;
public class MyTransformer extends SDXTransformer {
public MyTransformer(String xslSystemID)
throws TransformerException {
super(new StreamSource(xslSystemID));
}
public boolean wantDOM(String namespaceURI, String localName,
String qualifiedName, Attributes attributes)
throws SAXException {
return ...
}
public static void main(String args[]) {
TransformerRunner.run(MyTransformer.class.getName(),
args, new String[] { "xsl" });
}
}
Command Line Syntax:
java <className> -xsl <stylesheet> -in <input> [-out <output>]
[-indent <amount>] [-method <method>] [-encoding <encoding>]
[-omitdecl] [other application-specific parameters]
The run() method
transform() method of the created instance
MixedTransformer,
SmartTransformer,
WrapperTransformer| Field Summary | |
static int |
DEFAULT_INDENT
The default number of spaces for indenting |
static java.lang.String |
XALAN_PREFFIX
The prefix of the output properties that are Xalan specific |
| Constructor Summary | |
TransformerRunner()
|
|
| Method Summary | |
static void |
run(java.lang.String className,
java.lang.String[] args)
Creates an instance of a Transformer subclass,
configures it and calls its transform() method. |
static void |
run(java.lang.String className,
java.lang.String[] args,
java.lang.String[] params)
Creates an instance of a Transformer subclass,
configures it and calls its transform() method. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String XALAN_PREFFIX
public static final int DEFAULT_INDENT
| Constructor Detail |
public TransformerRunner()
| Method Detail |
public static void run(java.lang.String className,
java.lang.String[] args)
Transformer subclass,
configures it and calls its transform() method.
It uses the constructor that takes the system ID of the XSLT stylesheet
as parameter.
public static void run(java.lang.String className,
java.lang.String[] args,
java.lang.String[] params)
Transformer subclass,
configures it and calls its transform() method.
It uses the constructor with the given list of parameters.
|
Devsphere.com |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||