39 #ifndef OME_XML_MODEL_OMETRANSFORM_H 40 #define OME_XML_MODEL_OMETRANSFORM_H 45 #include <ome/common/xml/dom/Document.h> 46 #include <ome/common/xsl/Transformer.h> 47 #include <ome/xml/OMETransformResolver.h> 48 #include <ome/xml/OMEEntityResolver.h> 71 ome::compat::smatch found;
72 static const ome::compat::regex schema_match(
"^http://www.openmicroscopy.org/Schemas/OME/(.*)$");
74 if (ome::compat::regex_match(ns, found, schema_match))
78 else if (ns ==
"http://www.openmicroscopy.org/XMLschemas/OME/FC/ome.xsd")
99 template<
typename Input,
typename Output>
112 catch (
const std::runtime_error&)
122 if (source_schema.empty())
123 throw std::runtime_error(
"Impossible to determine model schema version");
126 transform_list transforms(transform_resolver.
transform_order(source_schema, target_schema));
130 if (transforms.first.empty())
140 std::istringstream is;
141 std::ostringstream os;
149 for (transform_list::first_type::const_iterator i = transforms.first.begin();
150 i != transforms.first.end();
156 if (i + 1 == transforms.first.end())
159 transformer.
transform(i->file, is, output);
192 template<
typename Input,
typename Output>
201 entity_resolver, transform_resolver);
207 #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:65
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:101
bool validationSchemaFullChecking