|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.fikin.xml.Stx
public class Stx
Makes STX operations easier.
This class provides absolutely the same same services as Xslt
but it is operating with STX instead of XSLT
The only difference is that it does not support JAXP factory settings as this is not needed for STX
Please refer to Xslt
documentation for full list of features and
services provided by this class
STX is "Streaming Trasnformation for XML", which is pretty much XSLT but tailored for SAX processing (thus accepting unlimited input data). STX spec
STX processor in use is Joost and it is available at Joost
Usage:
created on Oct 1, 2006
Stx stx = new Stx( Stx.newSAXSource( "my.stx" ) );
stx.transform( Stx.newSAXSource("my.xml") );
stx.transform( Stx.newSAXSource("my.xml"), new StreamResult( "my.txt" ) );
...
Constructor Summary | |
---|---|
Stx(javax.xml.transform.sax.SAXSource stx)
instantiate an template with xsl source |
Method Summary | |
---|---|
java.lang.String |
exportJavaObject(java.lang.Object obj)
if you want to thread-safe export a callback java object called from the xstl (via one or another java extension api): call this method with the object to be exported the return is a an unique key value with which you can look it up via lookupObject(String)
pass the key as a normal parameter to the xslt
in the xslt you have to use the java extension api available
and lookup the object via lookupObject(String) |
javax.xml.transform.ErrorListener |
getErrorListener()
get error listener, by default it is System.stderr based |
static java.lang.Object |
lookupObject(java.lang.String key)
lookup a previously exported java object via exportJavaObject(Object)
this method is called by xslt (via xslt vendor specific java extension
api) |
static javax.xml.transform.sax.SAXSource |
newSAXSource(java.io.File in)
instantiate a new source out of a file it uses buffered input stream |
static javax.xml.transform.sax.SAXSource |
newSAXSource(java.io.InputStream in)
instantiate a new source out of an input stream |
static javax.xml.transform.sax.SAXSource |
newSAXSource(java.io.Reader in)
instantiate a new source out of a reader |
static javax.xml.transform.sax.SAXSource |
newSAXSource(java.lang.String file)
instantiate a new source out of a file name |
static javax.xml.transform.sax.SAXSource |
newSAXSource(java.lang.String file,
java.lang.Class callingCls)
instantiate a new source out of a resource available in the classpath |
static javax.xml.transform.sax.SAXSource |
newSAXSource(java.lang.String fqnFile,
java.lang.ClassLoader cl)
instantiate a new source out of a resource available in the classpath when a classloader is provided, it will be used to resolve the resource. |
static javax.xml.transform.sax.SAXSource |
newSAXSource(java.lang.String file,
java.lang.Package pkg)
instantiate a new source out of a resource available in the classpath |
static javax.xml.transform.sax.SAXSource |
newSAXSource(java.net.URL in)
instantiate a new source out of an url location it uses buffered input stream |
void |
setErrorListener(javax.xml.transform.ErrorListener errorListener)
set error listener to one the user has defined |
void |
transform(javax.xml.transform.sax.SAXSource in)
transform in into output output is a dummy byte array stream |
void |
transform(javax.xml.transform.sax.SAXSource in,
java.util.Hashtable params)
transform in into output output is a dummy byte array stream |
void |
transform(javax.xml.transform.sax.SAXSource in,
javax.xml.transform.Result out)
transform in into output |
void |
transform(javax.xml.transform.sax.SAXSource in,
javax.xml.transform.Result out,
java.util.Hashtable params)
transform in into output |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Stx(javax.xml.transform.sax.SAXSource stx) throws javax.xml.transform.TransformerConfigurationException
stx
-
javax.xml.transform.TransformerConfigurationException
Method Detail |
---|
public void setErrorListener(javax.xml.transform.ErrorListener errorListener)
errorListener
- public javax.xml.transform.ErrorListener getErrorListener()
public void transform(javax.xml.transform.sax.SAXSource in, javax.xml.transform.Result out, java.util.Hashtable params) throws javax.xml.transform.TransformerException
in
- out
- params
-
javax.xml.transform.TransformerException
public void transform(javax.xml.transform.sax.SAXSource in, javax.xml.transform.Result out) throws javax.xml.transform.TransformerException
in
- out
-
javax.xml.transform.TransformerException
public void transform(javax.xml.transform.sax.SAXSource in, java.util.Hashtable params) throws javax.xml.transform.TransformerException
in
- params
-
javax.xml.transform.TransformerException
public void transform(javax.xml.transform.sax.SAXSource in) throws javax.xml.transform.TransformerException
in
-
javax.xml.transform.TransformerException
public java.lang.String exportJavaObject(java.lang.Object obj)
lookupObject(String)
lookupObject(String)
obj
-
public static java.lang.Object lookupObject(java.lang.String key)
exportJavaObject(Object)
this method is called by xslt (via xslt vendor specific java extension
api)
key
- is the key obtained by exportJavaObject(Object)
public static javax.xml.transform.sax.SAXSource newSAXSource(java.io.Reader in)
in
- is a reader object
public static javax.xml.transform.sax.SAXSource newSAXSource(java.io.InputStream in)
in
- is an input stream
public static javax.xml.transform.sax.SAXSource newSAXSource(java.io.File in) throws java.io.FileNotFoundException
in
- the file object
java.io.FileNotFoundException
public static javax.xml.transform.sax.SAXSource newSAXSource(java.net.URL in) throws java.io.IOException
in
- the url of the source
java.io.IOException
public static javax.xml.transform.sax.SAXSource newSAXSource(java.lang.String file) throws java.io.FileNotFoundException
file
- is the fully qualified file name
java.io.FileNotFoundException
public static javax.xml.transform.sax.SAXSource newSAXSource(java.lang.String fqnFile, java.lang.ClassLoader cl) throws java.lang.NullPointerException
fqnFile
- is the fully qualified name of the resourcecl
- is the classloader to be used, if null it tries with
Stx.class.getClassLoader() and if still is null tries
Thread.currentThread().getContextClassLoader(). when null is passed it
means the bootstraploader is meant.
NullPoinerException
- when no resource is found
java.lang.NullPointerException
public static javax.xml.transform.sax.SAXSource newSAXSource(java.lang.String file, java.lang.Package pkg)
file
- is the resource name (only file name)pkg
- is the package (i.e. java package) where the file is
public static javax.xml.transform.sax.SAXSource newSAXSource(java.lang.String file, java.lang.Class callingCls)
file
- is the resource name (only file name)callingCls
- is the class whose package the file is
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |