39 #ifndef OME_XML_MODEL_OMETRANSFORM_H 40 #define OME_XML_MODEL_OMETRANSFORM_H 43 #include <ome/common/xml/dom/Document.h> 44 #include <ome/common/xsl/Transformer.h> 45 #include <ome/xml/OMETransformResolver.h> 46 #include <ome/xml/OMEEntityResolver.h> 69 ome::compat::smatch found;
70 static const ome::compat::regex schema_match(
"^http://www.openmicroscopy.org/Schemas/OME/(.*)$");
72 if (ome::compat::regex_match(ns, found, schema_match))
76 else if (ns ==
"http://www.openmicroscopy.org/XMLschemas/OME/FC/ome.xsd")
97 template<
typename Input,
typename Output>
109 if (source_schema.empty())
110 throw std::runtime_error(
"Impossible to determine model schema version");
113 transform_list transforms(transform_resolver.
transform_order(source_schema, target_schema));
117 if (transforms.first.empty())
127 std::istringstream is;
128 std::ostringstream os;
136 for (transform_list::first_type::const_iterator i = transforms.first.begin();
137 i != transforms.first.end();
143 if (i + 1 == transforms.first.end())
146 transformer.
transform(i->file, is, output);
179 template<
typename Input,
typename Output>
188 entity_resolver, transform_resolver);
194 #endif // OME_XML_MODEL_OMETRANSFORM_H
Document createDocument(const boost::filesystem::path &file, EntityResolver &resolver, const ParseParameters ¶ms=ParseParameters())
void writeDocument(Document &document, const boost::filesystem::path &file, const WriteParameters ¶ms=WriteParameters())
Open Microscopy Environment C++ implementation.
std::string getModelVersion(ome::common::xml::dom::Document &document)
Determine the model schema version used in an XML document.
Definition: OMETransform.h:63
Element getDocumentElement()
void transform(const std::string &target_schema, const Input &input, Output &output, ome::common::xml::EntityResolver &entity_resolver, OMETransformResolver &transform_resolver)
Transform OME-XML to a different model schema version.
Definition: OMETransform.h:99