ome-common  5.5.0
Public Member Functions | Private Attributes | List of all members
ome::common::xsl::Transformer Class Reference

XSL Transformer. More...

#include <ome/common/xsl/Transformer.h>

+ Collaboration diagram for ome::common::xsl::Transformer:

Public Member Functions

 Transformer ()
 Construct a Transformer instance.
 
 ~Transformer ()
 Destructor.
 
xml::EntityResolvergetEntityResolver () 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::EntityResolverresolver
 EntityResolver to use with the transformer.
 

Detailed Description

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.

Member Function Documentation

◆ getEntityResolver()

xml::EntityResolver * ome::common::xsl::Transformer::getEntityResolver ( ) const

Get the entity resolver in use.

Returns
the entity resolver.

References resolver.

◆ getUseValidation()

bool ome::common::xsl::Transformer::getUseValidation ( ) const

Check if validation is enabled.

Returns
true if enabled, false if disabled.

References transformer.

◆ setEntityResolver()

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.

Parameters
resolverthe EntityResolver to use.

References resolver, and transformer.

◆ setUseValidation()

void ome::common::xsl::Transformer::setUseValidation ( bool  validate)

Enable or disable validation.

Validation is disabled by default.

Parameters
validatetrue to enable validation, false to disable.

References transformer.

◆ transform() [1/10]

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.

Parameters
xslthe XSL transform to apply.
inputthe source XML to transform.
outputwhere to store the result of the transformation.
Exceptions
std::runtime_erroron failure.

References transformer.

Referenced by transform().

+ Here is the caller graph for this function:

◆ transform() [2/10]

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).

Parameters
xslthe XSL transform file to apply.
inputthe file containing the XML to transform.
outputthe file to which to write the result of the transformation.
Exceptions
std::runtime_erroron failure.

References resolver, and transform().

◆ transform() [3/10]

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).

Parameters
xslthe XSL transform file to apply.
inputthe stream containing the XML to transform.
outputthe file to which to write the result of the transformation.
Exceptions
std::runtime_erroron failure.

References resolver, and transform().

◆ transform() [4/10]

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).

Parameters
xslthe XSL transform file to apply.
inputthe string containing the XML to transform.
outputthe file to which to write the result of the transformation.
Exceptions
std::runtime_erroron failure.

References resolver, and transform().

◆ transform() [5/10]

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).

Parameters
xslthe XSL transform file to apply.
inputthe file containing the XML to transform.
outputthe stream to which to write the result of the transformation.
Exceptions
std::runtime_erroron failure.

References resolver, and transform().

◆ transform() [6/10]

void ome::common::xsl::Transformer::transform ( const boost::filesystem::path &  xsl,
std::istream &  input,
std::ostream &  output 
)

Apply transform (stream to stream).

Parameters
xslthe XSL transform file to apply.
inputthe stream containing the XML to transform.
outputthe stream to which to write the result of the transformation.
Exceptions
std::runtime_erroron failure.

References resolver, and transform().

◆ transform() [7/10]

void ome::common::xsl::Transformer::transform ( const boost::filesystem::path &  xsl,
const std::string &  input,
std::ostream &  output 
)

Apply transform (string to stream).

Parameters
xslthe XSL transform file to apply.
inputthe string containing the XML to transform.
outputthe stream to which to write the result of the transformation.
Exceptions
std::runtime_erroron failure.

References resolver, and transform().

◆ transform() [8/10]

void ome::common::xsl::Transformer::transform ( const boost::filesystem::path &  xsl,
const boost::filesystem::path &  input,
std::string &  output 
)

Apply transform (path to string).

Parameters
xslthe XSL transform file to apply.
inputthe file containing the XML to transform.
outputthe string in which to store the result of the transformation.
Exceptions
std::runtime_erroron failure.

References resolver, and transform().

◆ transform() [9/10]

void ome::common::xsl::Transformer::transform ( const boost::filesystem::path &  xsl,
std::istream &  input,
std::string &  output 
)

Apply transform (stream to string).

Parameters
xslthe XSL transform file to apply.
inputthe stream containing the XML to transform.
outputthe string in which to store the result of the transformation.
Exceptions
std::runtime_erroron failure.

References resolver, and transform().

◆ transform() [10/10]

void ome::common::xsl::Transformer::transform ( const boost::filesystem::path &  xsl,
const std::string &  input,
std::string &  output 
)

Apply transform (string to string).

Parameters
xslthe XSL transform file to apply.
inputthe string containing the XML to transform.
outputthe string in which to store the result of the transformation.
Exceptions
std::runtime_erroron failure.

References resolver, and transform().


The documentation for this class was generated from the following files: