|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.xmlmill.JAXPTransformer
The JAXPTransformer instance takes care of the transformation of
xml data and a xsl stylesheet (or .mill file) to a pdf file.
*** A JAXPTransformer instance should not
be reused. ***: After having called the transform() method the instance should be discarded.
| Field Summary | |
static java.lang.String |
XSLTONLY
The Feature: http://com.xmlmill/transform/xslt-transformation-only" |
| Constructor Summary | |
JAXPTransformer()
Zero argument default constructor. |
|
JAXPTransformer(java.io.File xmlfile)
Constructor of a PDXTransform object. |
|
| Method Summary | |
java.lang.String |
getBaseURL()
Returns the baseURL against which relative URLs will be solved in the result-tree. |
org.xml.sax.ContentHandler |
getContentHandler()
Returns the internal ContentHandler instance
used to analyse the SAX events.
|
int |
getDocumentSize()
Returns the size of the generated document (in bytes). |
boolean |
getFeature(java.lang.String name)
Defines if the feature is set. |
javax.xml.validation.Schema |
getSchema()
Returns the defined javax.xml.validation.Schema instance.
|
java.lang.String |
getSchemaLocation(java.lang.String uri)
Return the URI of a schema to use to validate the result-tree against. |
javax.xml.transform.Templates |
getTemplates()
Returns the javax.xml.transform.Templates instance defined
|
boolean |
isValidating()
Returns if validation is on. |
void |
printComments(boolean b)
Deprecated. Use setFeature() instead. |
void |
setBaseURL(java.io.File f)
Sets the URL against which relative URLs in the result-tree will be resolved. |
void |
setBaseURL(java.lang.String url)
Defines the URL against which relative URLs in the result-tree will be resolved. |
void |
setBaseURL(java.net.URL url)
Sets the URI against which relative URIs in the result-tree will be resolved. |
void |
setDocumentSize(int size)
Defines the minimum size the document should contain (in bytes). |
void |
setErrorHandler(JAXPErrorHandler handler)
Defines the behavior of the errorhandler. |
void |
setFeature(java.lang.String name,
boolean b)
Sets the particular feature in the underlying implementation of com.xmlmill.PDXTransformHandler.
|
void |
setOutput(java.io.OutputStream ostream)
Deprecated. Use setOutPutStream() instead |
void |
setOutputFolder(java.io.File f)
Define the outputfolder. |
void |
setOutputStream(java.io.OutputStream ostream)
Defines the outputstream to put result in. |
void |
setSchema(javax.xml.validation.Schema schema)
Defines a javax.xml.validation.Schema instance.
|
void |
setSchemaLocation(java.lang.String uri)
Defines the javax.xml.validation.Schema to use to validate the result-tree against.
|
void |
setStylesheetParam(java.lang.String name,
java.lang.Object value)
Add a parameter for the transformation Pass a qualified name as a two-part string, the namespace URI enclosed in curly braces ({}), followed by the local name. |
void |
setTemplates(javax.xml.transform.Templates t)
Defines a javax.xml.transform.Templates instance.
|
void |
setValidating(boolean b)
Defines if the result tree of the xml/xsl transformation process should be validated. |
void |
setXMLDocument(org.w3c.dom.Document doc)
Defines the XML Document to be used. |
void |
setXMLDocument(java.io.File f)
Defines the XML Document to be used. |
void |
setXMLDocument(java.io.InputStream stream)
Defines the XML Document to be used. |
void |
setXMLDocument(java.io.Reader reader)
Defines the XML Document to be used. |
void |
setXMLDocument(java.net.URL url)
Defines the XML Document to be used. |
void |
setXMLEncoding(java.lang.String encoding)
Defines the XML encoding to be used. |
void |
setXMLFile(java.io.File f)
Deprecated. use setXMLDocument() instead. |
void |
setXMLPublicid(java.lang.String publicid)
Defines the public identifier for this XML input source. |
void |
setXMLReader(java.io.Reader reader)
Deprecated. use setXMLDocument() instead. |
void |
setXMLStream(java.io.InputStream stream)
Deprecated. use setXMLDocument() instead. |
void |
setXMLSystemId(java.io.File f)
Deprecated. Use setBaseURL() instead. |
void |
setXMLSystemId(java.lang.String systemid)
Deprecated. Use setBaseURL() instead. |
void |
setXMLSystemId(java.net.URL systemid)
Deprecated. Use setBaseURL() instead. |
void |
setXMLUrl(java.net.URL url)
Deprecated. use setXMLDocument() instead. |
void |
setXSLDocument(org.w3c.dom.Document doc)
Defines the the XSL Document as a DOM document. |
void |
setXSLDocument(java.io.File f)
Defines the XSL file used to convert a XML file. |
void |
setXSLDocument(java.io.InputStream stream)
Defines the XSL stream to be used. |
void |
setXSLDocument(java.io.Reader reader)
Defines the XSL reader to be used. |
void |
setXSLDocument(java.net.URL url)
Defines the XSL URL to be used. |
void |
setXSLFile(java.io.File f)
Deprecated. Use setXSLDocument() instead. |
void |
setXSLReader(java.io.Reader reader)
Deprecated. Use setXSLDocument() instead. |
void |
setXSLStream(java.io.InputStream stream)
Deprecated. Use setXSLDocument() instead. |
void |
setXSLSystemId(java.io.File f)
Deprecated. Use setBaseURL() instead. |
void |
setXSLSystemId(java.lang.String systemid)
Deprecated. Use setBaseURL() instead. |
void |
setXSLSystemId(java.net.URL systemid)
Deprecated. Use setBaseURL() instead. |
void |
setXSLTTransformationOnly(boolean b)
Deprecated. Use setFeature() instead. |
void |
setXSLUrl(java.net.URL url)
Deprecated. Use setXSLDocument() instead. |
void |
transform()
Generates a pdf file from a (xmlmill) xml file. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String XSLTONLY
http://com.xmlmill/transform/xslt-transformation-only"| Constructor Detail |
public JAXPTransformer()
public JAXPTransformer(java.io.File xmlfile)
Generate a JAXPTransform instance for every xml file to generate.
xmlfile - File representing a (xmlmill) xml file.| Method Detail |
public void setTemplates(javax.xml.transform.Templates t)
javax.xml.transform.Templates instance.
This javax.xml.transform.Templates instance is used
to define an internal javax.xml.transform.Transformer instance.
If a Templates instance is defined, it will take precedence over a
xsl-stylesheet defined in an xml document (using the <?xml-stylesheet href="..."
type="text/xsl"?> tag).
templates - A javax.xml.transform.Templates instance.public javax.xml.transform.Templates getTemplates()
javax.xml.transform.Templates instance defined
public void setSchema(javax.xml.validation.Schema schema)
javax.xml.validation.Schema instance.
The javax.xml.validation.Schema class is an "immutable" memory representation of schema. Once the schemas are loaded into memory and represented as a Schema instance, it can be used for validation. In this way, a single Schema instance can be shared with many different parser instances even running in different threads. Applications are encouraged to be written so that the same set of schema are parsed only once and the same Schema instance is passed to different instances of the parser.
Note:You need a JAXP 1.3 compliant implementation to use this method successfully.
schema - A javax.xml.validation.Schema instance.
public void setSchemaLocation(java.lang.String uri)
throws XMLMillFatalError
javax.xml.validation.Schema to use to validate the result-tree against.
Note:You need a JAXP 1.3 compliant implementation to use this method successfully.
String - representing the Schema location as a URI.
The URI should be fully resolved. For example: http://www.
xmlmill.com/test/xmlmill.xsd or file:///c:/xmlmill/test/xmlmill.xsdXMLMillFatalError - when a XMLMill fatal error occurs.
public java.lang.String getSchemaLocation(java.lang.String uri)
throws XMLMillFatalError
XMLMillFatalError - when a XMLMill fatal error occurs.public javax.xml.validation.Schema getSchema()
javax.xml.validation.Schema instance.
javax.xml.validation.Schema instance.public void setXMLDocument(java.io.File f)
Define the XML Document to be used via a java.io.File reference.
f - File representing the XML Document.public void setXMLDocument(java.io.InputStream stream)
Define the XML Document to be used via a java.io.Inputstream reference.
stream - InputStream representing the XML data.public void setXMLDocument(java.io.Reader reader)
Define the XML Document to be used via a java.io.Reader reference.
reader - Reader representing the XML data.public void setXMLDocument(java.net.URL url)
Define the XML Document to be used via a java.io.URL reference.
url - URL representing the XML data.public void setXMLDocument(org.w3c.dom.Document doc)
Define the XML Document to be used via a org.w3c.dom.Document reference.
doc - a org.w3c.dom.Document object.public void setXSLDocument(java.io.File f)
This file will be used if the XML file does not contain a reference to a XSL file. If it does, this XSL file will be ignored.
f - File representing the outputfolder.public void setXSLDocument(java.io.InputStream stream)
stream - InputStream representing the XSLDocument.public void setXSLDocument(java.io.Reader reader)
reader - Reader representing the XSLDocument.public void setXSLDocument(java.net.URL url)
url - URL representing the XSLDocument.public void setXSLDocument(org.w3c.dom.Document doc)
doc - a org.w3c.dom.Document object.
public void setBaseURL(java.lang.String url)
throws XMLMillFatalError
Generally, it's only necessary to set this property if the result-tree contains relative URLs.
Relative URIs are not allowed here. Base URIs must be absolute. The base URI may not be set to null or an empty string./p>
URL - representing the base URL.
The URL should be fully resolved. For example: "http://www.
xmlmill.com/test/" or "file:///c:/xmlmill/test/"XMLMillFatalError - when a XMLMill fatal error occurs.
public void setBaseURL(java.io.File f)
throws XMLMillFatalError
Generally, it's only necessary to set this property if the result-tree contains relative URLs.
Relative URIs are not allowed here. Base URIs must be absolute. The base URI may not be set to null or an empty string./p>
f - File representing the System Identifier.XMLMillFatalError - when a XMLMill fatal error occurs.
public void setBaseURL(java.net.URL url)
throws XMLMillFatalError
Generally, it's only necessary to set this property if the result-tree contains relative URIs.
Relative URIs are not allowed here. Base URIs must be absolute. The base URI may not be set to null or an empty string./p>
URI - representing the base URI.
The URI should be fully resolved. For example: "http://www.
xmlmill.com/test/" or "file:///c:/xmlmill/test/"XMLMillFatalError - when a XMLMill fatal error occurs.public java.lang.String getBaseURL()
public void setOutputFolder(java.io.File f)
The outputfolder is the folder where the generated pdf files will be put in. If no outputfolder is defined, the pdf file will be put in the folder that is defined in the XMLMill
f - File representing the outputfolder.public void setValidating(boolean b)
For backwards compatibility the validation is per default off.
b - boolean if validation should be done.public boolean isValidating()
public void setFeature(java.lang.String name,
boolean b)
throws XMLMillNotRecognizedException
com.xmlmill.PDXTransformHandler.
The following features can be defined:
| http://com.xmlmill/transform/XSLTTransformationOnly | |
| true: | Only a XSLT transformation should be done. The generated xml file that is normally send to the XMLMill transform object is written to a file. |
| false: | A normal transformation is done (a .pdf file is generated). |
| Default: | Feature is not set (false). |
name - The name of the feature to be set.b - The value of the feature to be set.XMLMILLNotRecognizedException - When the
property-name is not recognized.XSLTONLY
public boolean getFeature(java.lang.String name)
throws XMLMillNotRecognizedException
See setFeature() for more information concerning which features can be defined.
name - The feature name, as a complete URI.XMLMILLNotRecognizedException - When the
property-name is not recognized.public void setXMLPublicid(java.lang.String publicid)
The public identifier is always optional: if the application writer includes one, it will be provided as part of the location information.
publicid - String representing the public identifier.public void setXMLEncoding(java.lang.String encoding)
Set the character encoding, if known. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML 1.0 recommendation). This method has no effect when the application provides a character stream.
encoding - String describing the character encoding.public void setOutputStream(java.io.OutputStream ostream)
If the XMLMill 'file' attribute in the <document> tag defines a filename, the outputstream defined here will override this.
ostream - Outputstream representing the outputstream.public int getDocumentSize()
Returns the size of the generated document. This method can be used by a servlet to get the number of bytes written to the stream so it can be mentioned in the setContentLength() method of the response object.
public void setDocumentSize(int size)
With IE it is possible that when the size of the PDF document is smaller than the buffer-size defined by your servlet container, the document is not displayed (although Adobe opens correctly). With this method XMLMill is forced to generate a document that has a least a minimum size of the parameter passed.
size - representing the minimum size of the document (in bytes).public void setErrorHandler(JAXPErrorHandler handler)
Defines whether or not the log and stop processing when a error or warning happens.
handler - the errors handler.
public org.xml.sax.ContentHandler getContentHandler()
throws org.xml.sax.SAXException,
XMLMillFatalError,
java.io.IOException
ContentHandler instance
used to analyse the SAX events.
*** This method should be used with care (and preferably not at all). ***
Returns the internal ContentHandler instance
that is responsible for analyzing (and acting upon)
the SAX events it receives.
The returned ContentHandler is:
PDXTransformHandler instance
responsible for analyzing (and acting upon) the SAX events it receives.ValidatorHandler instance that is wrapped around the
internal PDXTransformHandler instance and will perform validation
first before the SAX events are passed to the PDXTransformHandler
instance .The ValidatorHandler instance will only be instantiated when
following conditions are met:
setValidation() method.setVersion() method is used to define the correct version.setSchemaLocation()
method or setSchema() method.Note:This method can be used if you have built the ML tree yourself
and willing to fire the SAX events yourselves to a
org.xml.sax.ContentHandler instance.
ContentHandler instance.org.xml.sax.SAXException - XMLMillException -
public void setStylesheetParam(java.lang.String name,
java.lang.Object value)
Pass a qualified name as a two-part string, the namespace URI enclosed in curly braces ({}), followed by the local name. If the name has a null URL, the String only contain the local name. An application can safely check for a non-null URI by testing to see if the first character of the name is a '{' character.
For example, if a URI and local name were obtained from an element defined with <xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, then the qualified name would be "http://xyz.foo.com/yada/baz.html}foo". Note that no prefix is used.
name - The name of the parameter, which may begin with a namespace URI in curly braces ({}).value - The value object. This can be any valid Java object. It is up to the processor
to provide the proper object coersion or to simply pass the object on for use in an extension.
public void transform()
throws javax.xml.transform.TransformerException,
javax.xml.transform.TransformerConfigurationException,
java.io.IOException,
org.xml.sax.SAXException,
java.lang.Exception,
XMLMillException
Calling this method will start the actual generation process.
javax.xml.transform.TransformerException - javax.xml.transform.TransformerConfigurationException - java.io.IOException - org.xml.sax.SAXException - java.lang.Exception - XMLMillException - public void setXMLFile(java.io.File f)
f - File representing the XML data.public void setXMLStream(java.io.InputStream stream)
stream - InputStream representing the XML data.public void setXMLReader(java.io.Reader reader)
reader - Reader representing the XML data.public void setXMLUrl(java.net.URL url)
url - URL representing the XML data.public void setXSLTTransformationOnly(boolean b)
If true the generated xml file that is normally send to the XMLMill transform object will now be written to a file.
b - boolean defining is XSLT transformation
should be done only.public void printComments(boolean b)
All comments, which are send to the LexicalHandler are printed in the logfile.
b - boolean indication whether or not to
print comments in the log file.
public void setXMLSystemId(java.lang.String systemid)
throws XMLMillFatalError
Set the system identifier for this inputSource. The system identifier is optional if there is a byte stream or a character stream, but it is still useful to provide one, since the application can use it to resolve relative URIs and can include it in error messages and warnings (the parser will attempt to open a connection to the URI only if there is no byte stream or character stream specified).
systemid - representing the System Identifier (URI).
The URI should be fully resolved. For example: http://www.
xmlmill.com/test/phonelist.xml or file:///c:/xmlmill/test/phonelist.xml
public void setXMLSystemId(java.io.File f)
throws XMLMillFatalError
Set the system identifier for this inputSource. The system identifier is optional if there is a byte stream or a character stream, but it is still useful to provide one, since the application can use it to resolve relative URIs and can include it in error messages and warnings (the parser will attempt to open a connection to the URI only if there is no byte stream or character stream specified).
f - File representing the System Identifier.
The File object should be defined absolute.
public void setXMLSystemId(java.net.URL systemid)
throws XMLMillFatalError
Set the system identifier for this inputSource. The system identifier is optional if there is a byte stream or a character stream, but it is still useful to provide one, since the application can use it to resolve relative URIs and can include it in error messages and warnings (the parser will attempt to open a connection to the URI only if there is no byte stream or character stream specified).
systemid - URL representing the System Identifier (URI).
The URI should be fully resolved. For example: http://www.
xmlmill.com/test/phonelist.xml or file:///c:/xmlmill/test/phonelist.xml
public void setXSLSystemId(java.lang.String systemid)
throws XMLMillFatalError
Set the system identifier for this stylesheet Source. The system identifier is optional if there is a byte stream or a character stream, but it is still useful to provide one, since the application can use it to resolve relative URIs and can include it in error messages and warnings (the parser will attempt to open a connection to the URI only if there is no byte stream or character stream specified).
systemid - representing the System Identifier (URI).
The URI should be fully resolved. For example: http://www.
xmlmill.com/test/phonelist.xsl or file:///c:/xmlmill/test/phonelist.xsl
public void setXSLSystemId(java.io.File f)
throws XMLMillFatalError
Set the system identifier for this stylesheet Source. The system identifier is optional if there is a byte stream or a character stream, but it is still useful to provide one, since the application can use it to resolve relative URIs and can include it in error messages and warnings (the parser will attempt to open a connection to the URI only if there is no byte stream or character stream specified).
f - File representing the System Identifier.
The File object should be defined absolute.
public void setXSLSystemId(java.net.URL systemid)
throws XMLMillFatalError
Set the system identifier for this stylesheet Source. The system identifier is optional if there is a byte stream or a character stream, but it is still useful to provide one, since the application can use it to resolve relative URIs and can include it in error messages and warnings (the parser will attempt to open a connection to the URI only if there is no byte stream or character stream specified).
systemid - representing the System Identifier (URI).
The URI should be fully resolved. For example: http://www.
xmlmill.com/test/phonelist.xml or file:///c:/xmlmill/test/phonelist.xmlpublic void setOutput(java.io.OutputStream ostream)
If the XMLMill
ostream - Outputstream representing the outputstream.public void setXSLFile(java.io.File f)
This file will be used if the XML file does not contain a reference to a XSL file. If it does, this XSL file will be ignored.
f - File representing the outputfolder.public void setXSLStream(java.io.InputStream stream)
stream - InputStream representing the XSLDocument.public void setXSLReader(java.io.Reader reader)
reader - Reader representing the XSLDocument.public void setXSLUrl(java.net.URL url)
url - URL representing the XSLDocument.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||