ome-common  5.4.0
Transformer.h
1 /*
2  * #%L
3  * OME-XALAN C++ library for working with Xalan C++.
4  * %%
5  * Copyright © 2016 Open Microscopy Environment:
6  * - Massachusetts Institute of Technology
7  * - National Institutes of Health
8  * - University of Dundee
9  * - Board of Regents of the University of Wisconsin-Madison
10  * - Glencoe Software, Inc.
11  * %%
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions are met:
14  *
15  * 1. Redistributions of source code must retain the above copyright notice,
16  * this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright notice,
18  * this list of conditions and the following disclaimer in the documentation
19  * and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * The views and conclusions contained in the software and documentation are
34  * those of the authors and should not be interpreted as representing official
35  * policies, either expressed or implied, of any organization.
36  * #L%
37  */
38 
39 #ifndef OME_COMMON_XSL_TRANSFORMER_H
40 #define OME_COMMON_XSL_TRANSFORMER_H
41 
42 #include <boost/filesystem/path.hpp>
43 
44 #include <ome/compat/memory.h>
45 
46 #include <ome/common/xml/EntityResolver.h>
47 
48 #include <xalanc/XalanTransformer/XalanTransformer.hpp>
49 
50 namespace ome
51 {
52  namespace common
53  {
54  namespace xsl
55  {
56 
69  {
70  public:
74  Transformer();
75 
79  ~Transformer();
80 
87  getEntityResolver() const;
88 
97  void
99 
105  bool
106  getUseValidation() const;
107 
116  void
117  setUseValidation(bool validate);
118 
132  void
133  transform(xalanc::XSLTInputSource& xsl,
134  xalanc::XSLTInputSource& input,
135  xalanc::XSLTResultTarget& output);
136 
145  void
146  transform(const boost::filesystem::path& xsl,
147  const boost::filesystem::path& input,
148  const boost::filesystem::path& output);
149 
158  void
159  transform(const boost::filesystem::path& xsl,
160  std::istream& input,
161  const boost::filesystem::path& output);
162 
171  void
172  transform(const boost::filesystem::path& xsl,
173  const std::string& input,
174  const boost::filesystem::path& output);
175 
184  void
185  transform(const boost::filesystem::path& xsl,
186  const boost::filesystem::path& input,
187  std::ostream& output);
188 
197  void
198  transform(const boost::filesystem::path& xsl,
199  std::istream& input,
200  std::ostream& output);
201 
210  void
211  transform(const boost::filesystem::path& xsl,
212  const std::string& input,
213  std::ostream& output);
214 
223  void
224  transform(const boost::filesystem::path& xsl,
225  const boost::filesystem::path& input,
226  std::string& output);
227 
236  void
237  transform(const boost::filesystem::path& xsl,
238  std::istream& input,
239  std::string& output);
240 
249  void
250  transform(const boost::filesystem::path& xsl,
251  const std::string& input,
252  std::string& output);
253 
254  private:
256  xalanc::XalanTransformer transformer;
259  };
260 
261  }
262  }
263 }
264 
265 #endif // OME_COMMON_XSL_TRANSFORMER_H
266 
267 /*
268  * Local Variables:
269  * mode:C++
270  * End:
271  */
bool getUseValidation() const
Check if validation is enabled.
Definition: Transformer.cpp:241
Memory type substitution.
xalanc::XalanTransformer transformer
Xalan-C transformer being wrapped.
Definition: Transformer.h:256
xml::EntityResolver * getEntityResolver() const
Get the entity resolver in use.
Definition: Transformer.cpp:228
void setUseValidation(bool validate)
Enable or disable validation.
Definition: Transformer.cpp:247
void setEntityResolver(xml::EntityResolver *resolver)
Set the entity resolver to use.
Definition: Transformer.cpp:234
Xerces entity resolver.
Definition: EntityResolver.h:66
void transform(xalanc::XSLTInputSource &xsl, xalanc::XSLTInputSource &input, xalanc::XSLTResultTarget &output)
Apply transform (XSLT abstract input and output).
Definition: Transformer.cpp:253
Open Microscopy Environment C++.
Definition: base64.h:48
XSL Transformer.
Definition: Transformer.h:68
Transformer()
Construct a Transformer instance.
Definition: Transformer.cpp:217
xml::EntityResolver * resolver
EntityResolver to use with the transformer.
Definition: Transformer.h:258
~Transformer()
Destructor.
Definition: Transformer.cpp:223