|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.activemath.xsl.Processor
org.activemath.xsl.JaxpProcessor
public class JaxpProcessor
Class JaxpProcessor
A class for centrally processing the stylesheet transformations. This class uses the jaxp transformation standard, including the URI resolving facilities.
These allow imports of stylesheets to be all relative to a single base URI.
For the reason that JAXP is an API standard but not a real processor for
processing stylesheets it has to be told which one to use. For this you have
to set the system property "javax.xml.transform.TransformerFactory" to the
name of a class of a specific stylesheetprocessor which has an implentation
of the JAXP API. For example SAXON is one of these processors. In this
example you have to set javax.xml.transform.TransformerFactory=com.icl.saxon.TransformerFactoryImpl
in your system properties.
| Field Summary | |
|---|---|
protected Hashtable |
importedStylesheets
Hashtable with all stylesheets imported (as Set) by a stylesheet |
protected static Category |
log
|
protected Hashtable |
preparedTemplates
Hashtable with prepared transformers for a given Stylesheet |
protected Hashtable |
timestamps
Hashtable with the timestamps long of the last modification of
the stylesheet |
| Fields inherited from class org.activemath.xsl.Processor |
|---|
baseURI, hasGeneratedSymbolImports, thisLogCat |
| Constructor Summary | |
|---|---|
JaxpProcessor()
Constructor * set baseURI to the Manager's one |
|
JaxpProcessor(String baseURI)
Constructor |
|
JaxpProcessor(URL base)
Constructor |
|
| Method Summary | |
|---|---|
protected void |
calcImports0(String stylesheet,
Set imports)
|
protected TransformerFactory |
getTransformerFactory()
get a instance of TransformerFactory |
Templates |
loadTemplate(String stylesheet)
get a templates object for the given stylesheet If the wanted one already exists then return this one else create a new one an return it If the wanted one already exists but has been modified then a new Templates will be created for the new stylesheet an replace the old one. |
void |
loadTemplateAsync(String stylesheet)
Loads a template asynchronously. |
static void |
main(String[] args)
method for testing parameters: first: URI of the stylesheet to use second:URI of the document to transform [third]:base URI for the Stylesheet (optional) If the third parameter is not set use the Manager's URI |
void |
transform(org.jdom.Document document,
OutputStream outStream,
String stylesheet,
Hashtable params)
transform a JDOM document by the given Stylesheet |
void |
transform(org.jdom.Document document,
Result result,
String stylesheet,
Hashtable params)
transform a JDOM document by the given Stylesheet |
void |
transform(org.jdom.Document document,
Writer writer,
String stylesheet,
Hashtable params)
transform a JDOM document by the given Stylesheet |
void |
transform(InputStream inStream,
OutputStream outStream,
String stylesheet,
Hashtable params)
transform a xml document by the given Stylesheet |
void |
transform(Source inputSource,
Result outputResult,
String stylesheet,
Hashtable params)
transform a xml document by the given Stylesheet |
org.jdom.Document |
transform2Jdom(org.jdom.Document document,
String stylesheet,
Hashtable params)
transform a jdom document by the given Stylesheet Be aware that the resulting document has to be XML code to output a JDOOM document |
| Methods inherited from class org.activemath.xsl.Processor |
|---|
getBaseURI, setBaseURI, setBaseURI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static Category log
protected Hashtable preparedTemplates
protected Hashtable timestamps
long of the last modification of
the stylesheet
protected Hashtable importedStylesheets
| Constructor Detail |
|---|
public JaxpProcessor()
throws MalformedURLException
* set baseURI to the Manager's one
MalformedURLException - Description of Exception
public JaxpProcessor(String baseURI)
throws MalformedURLException
base - the base URI of the stylesheets
to use
MalformedURLException - In case the URI is malformedpublic JaxpProcessor(URL base)
base - the base URI of the stylesheets
to use
MalformedURLException - In case the URI is malformed| Method Detail |
|---|
public static void main(String[] args)
throws Exception
parameters:
args - The command line arguments
Exceptionpublic Templates loadTemplate(String stylesheet)
If the wanted one already exists then return this one else create a new one an return it
If the wanted one already exists but has been modified then a new Templates will be created for the new stylesheet an replace the old one.
loadTemplate in interface StylesheetsloadTemplate in class Processorstylesheet - the URI of the
stylesheet to use for loading (may be absolute or relative to the
baseURI)
null if the template couldn't be loaded)
TransformerException - If anything happened during the transformation
public org.jdom.Document transform2Jdom(org.jdom.Document document,
String stylesheet,
Hashtable params)
throws TransformerException
Be aware that the resulting document has to be XML code to output a JDOOM document
transform2Jdom in class Processordocument - the jdom document to
transformstylesheet - the URI of the
stylesheet used for transformationparams - the parameters used
during transformation (as Hashtable) - may be null
TransformerException - Description of
Exception
public void transform(org.jdom.Document document,
Result result,
String stylesheet,
Hashtable params)
throws TransformerException
transform in interface Stylesheetstransform in class Processordocument - the JDOM document to
transformresult - the Result
of the transformation (that means: the transformed document)stylesheet - the URI of the
stylesheet used for transformationparams - the parameters used
during transformation (as Hashtable) - may be null
TransformerException - Description of
Exception
public void transform(org.jdom.Document document,
OutputStream outStream,
String stylesheet,
Hashtable params)
throws TransformerException
transform in interface Stylesheetstransform in class Processordocument - the JDOM document to
transformoutStream - the resultingOutputStream
of the transformationstylesheet - the URI of the
stylesheet used for transformationparams - the parameters used
during transformation (as Hashtable) - may be null
TransformerException - Description of
Exception
public void transform(org.jdom.Document document,
Writer writer,
String stylesheet,
Hashtable params)
throws TransformerException
transform in interface Stylesheetstransform in class Processordocument - the JDOM document to
transformstylesheet - the URI of the
stylesheet used for transformationparams - the parameters used
during transformation (as Hashtable) - may be nullwriter - Description of
Parameter
TransformerException - Description of
Exception
public void transform(Source inputSource,
Result outputResult,
String stylesheet,
Hashtable params)
throws TransformerException
transform in interface Stylesheetstransform in class ProcessorinputSource - the Source
of the xml document to transformoutputResult - the Result
of the transformation (that means: the transformed document)stylesheet - the URI of the
stylesheet used for transformationparams - the parameters used
during transformation (as Hashtable) - may be null
TransformerException - Description of
Exception
public void transform(InputStream inStream,
OutputStream outStream,
String stylesheet,
Hashtable params)
throws TransformerException
transform in interface Stylesheetstransform in class ProcessorinStream - the InputStream
of the xml document to transformoutStream - the resultingOutputStream
of the transformationstylesheet - the URI of the
stylesheet used for transformationparams - the parameters used
during transformation (as Hashtable) - may be null
TransformerException - Description of
Exceptionprotected TransformerFactory getTransformerFactory()
TransformerFactory
protected void calcImports0(String stylesheet,
Set imports)
public void loadTemplateAsync(String stylesheet)
Stylesheets
loadTemplateAsync in interface StylesheetsloadTemplateAsync in class Processor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||