ome-common 5.2.0-m2

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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:
[legend]

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

## 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

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

Get the entity resolver in use.

Returns
  the entity resolver.

References resolver.

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

Check if validation is enabled.

Returns
  `true` if enabled, `false` if disabled.

References transformer.

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

  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.

Parameters

  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.

Parameters

  xsl | the XSL transform to apply.
  input | the source XML to transform.
  output | where to store the result of the transformation.

Exceptions

  std::runtime_error | on failure.

References transformer.

Referenced by transform().

Here is the caller graph for this function:

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

  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.

Exceptions

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

Parameters

  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.

Exceptions

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

Parameters

  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.

Exceptions

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

Parameters

  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.

Exceptions

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

Parameters

  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.

Exceptions

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

Parameters

  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.

Exceptions

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

Parameters

  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.

Exceptions

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

Parameters

  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.

Exceptions

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

Parameters

  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.

Exceptions

  std::runtime_error | on failure.

References resolver, and transform().

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

- ome/common/xsl/Transformer.h
- ome/common/xsl/Transformer.cpp