ome-common
5.5.0
|
XSL Transformer. More...
#include <ome/common/xsl/Transformer.h>
Public Member Functions | |
Transformer () | |
Construct a Transformer instance. | |
~Transformer () | |
Destructor. | |
xml::EntityResolver * | getEntityResolver () const |
Get the entity resolver in use. More... | |
void | setEntityResolver (xml::EntityResolver *resolver) |
Set the entity resolver to use. More... | |
bool | getUseValidation () const |
Check if validation is enabled. More... | |
void | setUseValidation (bool validate) |
Enable or disable validation. More... | |
void | transform (xalanc::XSLTInputSource &xsl, xalanc::XSLTInputSource &input, xalanc::XSLTResultTarget &output) |
Apply transform (XSLT abstract input and output). More... | |
void | transform (const boost::filesystem::path &xsl, const boost::filesystem::path &input, const boost::filesystem::path &output) |
Apply transform (file path to file path). More... | |
void | transform (const boost::filesystem::path &xsl, std::istream &input, const boost::filesystem::path &output) |
Apply transform (stream to file path). More... | |
void | transform (const boost::filesystem::path &xsl, const std::string &input, const boost::filesystem::path &output) |
Apply transform (string to file path). More... | |
void | transform (const boost::filesystem::path &xsl, const boost::filesystem::path &input, std::ostream &output) |
Apply transform (file path to stream). More... | |
void | transform (const boost::filesystem::path &xsl, std::istream &input, std::ostream &output) |
Apply transform (stream to stream). More... | |
void | transform (const boost::filesystem::path &xsl, const std::string &input, std::ostream &output) |
Apply transform (string to stream). More... | |
void | transform (const boost::filesystem::path &xsl, const boost::filesystem::path &input, std::string &output) |
Apply transform (path to string). More... | |
void | transform (const boost::filesystem::path &xsl, std::istream &input, std::string &output) |
Apply transform (stream to string). More... | |
void | transform (const boost::filesystem::path &xsl, const std::string &input, std::string &output) |
Apply transform (string to string). More... | |
Private Attributes | |
xalanc::XalanTransformer | transformer |
Xalan-C transformer being wrapped. | |
xml::EntityResolver * | resolver |
EntityResolver to use with the transformer. | |
XSL Transformer.
This class wraps calls to the xalanc::Transformer transform functions, to allow their use in a safe manner. Create an instance of this class prior to performing any work with Xalan, and ensure it will remain in scope for all work to complete. When the scope is exited, or an exception is thrown, Xalan will be automatically terminated. Any number of instances of this class may be created; Xalan will only be terminated when the last instance is destroyed.
xml::EntityResolver * ome::common::xsl::Transformer::getEntityResolver | ( | ) | const |
bool ome::common::xsl::Transformer::getUseValidation | ( | ) | const |
void ome::common::xsl::Transformer::setEntityResolver | ( | xml::EntityResolver * | resolver | ) |
Set the entity resolver to use.
This will be used to fetch the XML schemas required to validate the XML documents being transformed.
resolver | the EntityResolver to use. |
References resolver, and transformer.
void ome::common::xsl::Transformer::setUseValidation | ( | bool | validate | ) |
Enable or disable validation.
Validation is disabled by default.
validate | true to enable validation, false to disable. |
References transformer.
void ome::common::xsl::Transformer::transform | ( | xalanc::XSLTInputSource & | xsl, |
xalanc::XSLTInputSource & | input, | ||
xalanc::XSLTResultTarget & | output | ||
) |
Apply transform (XSLT abstract input and output).
This generic method is called internally by all the other transform() methods. The other methods will be more convenient to use, since they allow direct use of files, streams and strings for both input and output.
xsl | the XSL transform to apply. |
input | the source XML to transform. |
output | where to store the result of the transformation. |
std::runtime_error | on failure. |
References transformer.
Referenced by transform().
void ome::common::xsl::Transformer::transform | ( | const boost::filesystem::path & | xsl, |
const boost::filesystem::path & | input, | ||
const boost::filesystem::path & | output | ||
) |
Apply transform (file path to file path).
xsl | the XSL transform file to apply. |
input | the file containing the XML to transform. |
output | the file to which to write the result of the transformation. |
std::runtime_error | on failure. |
References resolver, and transform().
void ome::common::xsl::Transformer::transform | ( | const boost::filesystem::path & | xsl, |
std::istream & | input, | ||
const boost::filesystem::path & | output | ||
) |
Apply transform (stream to file path).
xsl | the XSL transform file to apply. |
input | the stream containing the XML to transform. |
output | the file to which to write the result of the transformation. |
std::runtime_error | on failure. |
References resolver, and transform().
void ome::common::xsl::Transformer::transform | ( | const boost::filesystem::path & | xsl, |
const std::string & | input, | ||
const boost::filesystem::path & | output | ||
) |
Apply transform (string to file path).
xsl | the XSL transform file to apply. |
input | the string containing the XML to transform. |
output | the file to which to write the result of the transformation. |
std::runtime_error | on failure. |
References resolver, and transform().
void ome::common::xsl::Transformer::transform | ( | const boost::filesystem::path & | xsl, |
const boost::filesystem::path & | input, | ||
std::ostream & | output | ||
) |
Apply transform (file path to stream).
xsl | the XSL transform file to apply. |
input | the file containing the XML to transform. |
output | the stream to which to write the result of the transformation. |
std::runtime_error | on failure. |
References resolver, and transform().
void ome::common::xsl::Transformer::transform | ( | const boost::filesystem::path & | xsl, |
std::istream & | input, | ||
std::ostream & | output | ||
) |
Apply transform (stream to stream).
xsl | the XSL transform file to apply. |
input | the stream containing the XML to transform. |
output | the stream to which to write the result of the transformation. |
std::runtime_error | on failure. |
References resolver, and transform().
void ome::common::xsl::Transformer::transform | ( | const boost::filesystem::path & | xsl, |
const std::string & | input, | ||
std::ostream & | output | ||
) |
Apply transform (string to stream).
xsl | the XSL transform file to apply. |
input | the string containing the XML to transform. |
output | the stream to which to write the result of the transformation. |
std::runtime_error | on failure. |
References resolver, and transform().
void ome::common::xsl::Transformer::transform | ( | const boost::filesystem::path & | xsl, |
const boost::filesystem::path & | input, | ||
std::string & | output | ||
) |
Apply transform (path to string).
xsl | the XSL transform file to apply. |
input | the file containing the XML to transform. |
output | the string in which to store the result of the transformation. |
std::runtime_error | on failure. |
References resolver, and transform().
void ome::common::xsl::Transformer::transform | ( | const boost::filesystem::path & | xsl, |
std::istream & | input, | ||
std::string & | output | ||
) |
Apply transform (stream to string).
xsl | the XSL transform file to apply. |
input | the stream containing the XML to transform. |
output | the string in which to store the result of the transformation. |
std::runtime_error | on failure. |
References resolver, and transform().
void ome::common::xsl::Transformer::transform | ( | const boost::filesystem::path & | xsl, |
const std::string & | input, | ||
std::string & | output | ||
) |
Apply transform (string to string).
xsl | the XSL transform file to apply. |
input | the string containing the XML to transform. |
output | the string in which to store the result of the transformation. |
std::runtime_error | on failure. |
References resolver, and transform().