![]() |
CTK
0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
|
Transforms a given XML input using an XML stylesheet. More...
#include <Libs/CommandLineModules/Core/ctkCmdLineModuleXslTransform.h>
Public Member Functions | |
void | bindVariable (const QString &name, const QVariant &value) |
Binds the variable name to the value so that $name can be used from within the query to refer to the value. In the default XslTransformation, the widget classes are variable and can be replaced with a new binding. More... | |
ctkCmdLineModuleXslTransform (QIODevice *input=0, QIODevice *output=0) | |
virtual bool | error () const |
Returns true if an error occured. More... | |
virtual QString | errorString () const |
Returns the error message if any. More... | |
bool | formatXmlOutput () const |
Returns true if the XSL output will be formatted. More... | |
QIODevice * | output () const |
Get the output device to which the transformation will be written. More... | |
void | setFormatXmlOutput (bool format) |
Formats the XSL output to be human-readable. More... | |
void | setOutput (QIODevice *output) |
Set the output device to which the transformation will be written. More... | |
void | setOutputSchema (QIODevice *output) |
Set an XML schema for output validation. More... | |
void | setValidateOutput (bool validate) |
Sets the output validation mode. More... | |
void | setXslExtraTransformation (QIODevice *transformation) |
XSL to be injected in the main XSL. More... | |
void | setXslExtraTransformations (const QList< QIODevice * > &transformations) |
void | setXslTransformation (QIODevice *transformation) |
Sets the XSL transformation. More... | |
bool | transform () |
Transforms an XML input via a XSL transformation. More... | |
bool | validateOutput () const |
Get the output validation mode. More... | |
virtual | ~ctkCmdLineModuleXslTransform () |
![]() | |
ctkCmdLineModuleXmlValidator (QIODevice *input=0) | |
QIODevice * | input () const |
Get the XML input device. More... | |
void | setInput (QIODevice *input) |
Set the XML input. More... | |
void | setInputSchema (QIODevice *input) |
Set the XML schema to be used during validation. More... | |
virtual bool | validateInput () |
Validate the XML input against the XML schema set via setInputSchema(). More... | |
~ctkCmdLineModuleXmlValidator () | |
Transforms a given XML input using an XML stylesheet.
You must call setInput(), setOutput() and setXslTransformation() before calling transform().
Definition at line 43 of file ctkCmdLineModuleXslTransform.h.
ctkCmdLineModuleXslTransform::ctkCmdLineModuleXslTransform | ( | QIODevice * | input = 0 , |
QIODevice * | output = 0 |
||
) |
|
virtual |
void ctkCmdLineModuleXslTransform::bindVariable | ( | const QString & | name, |
const QVariant & | value | ||
) |
Binds the variable name to the value so that $name can be used from within the query to refer to the value. In the default XslTransformation, the widget classes are variable and can be replaced with a new binding.
|
virtual |
Returns true if an error occured.
transform() sets the error flag if an error occured when transforming the XML file into XSL or validating the transformation.
Reimplemented from ctkCmdLineModuleXmlValidator.
|
virtual |
Returns the error message if any.
transform() sets the error message if an error occured when transforming the XML file into XSL.
Reimplemented from ctkCmdLineModuleXmlValidator.
bool ctkCmdLineModuleXslTransform::formatXmlOutput | ( | ) | const |
Returns true
if the XSL output will be formatted.
true
if the ouptut will be formatted, false
otherwise. QIODevice* ctkCmdLineModuleXslTransform::output | ( | ) | const |
Get the output device to which the transformation will be written.
void ctkCmdLineModuleXslTransform::setFormatXmlOutput | ( | bool | format | ) |
Formats the XSL output to be human-readable.
It is assumed that the XSL output is valid XML. The output will be formatted with an indentation depth of four spaces. Note that setting format
to true
increases compuational overhead and memory requirements and is usually only done for testing or debugging purposes.
void ctkCmdLineModuleXslTransform::setOutput | ( | QIODevice * | output | ) |
Set the output device to which the transformation will be written.
output | The output device. |
If no output device is set, a default device will be used.
void ctkCmdLineModuleXslTransform::setOutputSchema | ( | QIODevice * | output | ) |
Set an XML schema for output validation.
output | The XML schema against which the transformation will be validated. |
Output validation will only be done if validateOutput() returns true
.
void ctkCmdLineModuleXslTransform::setValidateOutput | ( | bool | validate | ) |
Sets the output validation mode.
validate | If true , the output will be validated against the XML schema provided via setOutputSchema(). If validate is false , no output validation takes place. |
void ctkCmdLineModuleXslTransform::setXslExtraTransformation | ( | QIODevice * | transformation | ) |
XSL to be injected in the main XSL.
This can be used to potentially overwrite templates. To avoid ambiguity, specify a priority > 1 in your overwriting templates
transformation | Extra XSL transformation fragment. |
void ctkCmdLineModuleXslTransform::setXslExtraTransformations | ( | const QList< QIODevice * > & | transformations | ) |
void ctkCmdLineModuleXslTransform::setXslTransformation | ( | QIODevice * | transformation | ) |
Sets the XSL transformation.
Use this method to set the XSL transformation for this instance. Trying to transform the input without setting a transformation will result in runtime errors.
transformation | The XSL transformation. |
bool ctkCmdLineModuleXslTransform::transform | ( | ) |
Transforms an XML input via a XSL transformation.
This method assumes that the input set via setInput() or supplied in the constructor is a valid, non empty XML fragment and that setOutput() and setXslTransformation() was called with non-null arguments.
bool ctkCmdLineModuleXslTransform::validateOutput | ( | ) | const |
Get the output validation mode.
true
if the output will be validated, false
otherwise.