5#include <libxml++/libxml++.h>
13#if LIBXMLXX_MAJOR_VERSION == 2
17 typedef xmlpp::Node::NodeSet
NodeSet;
23 parser_ =
new xmlpp::DomParser();
33 if (parser_ != NULL) {
36 parser_ =
new xmlpp::DomParser();
40 parser_->parse_memory(xml_input_snippet);
44 }
catch (
const std::exception& ex) {
45 throw ValidationError(
"Error loading xml file: " + std::string(ex.what()));
50 Init(xml_input_snippet.str());
62 xmlpp::Document* doc = parser_->get_document();
64 bool generate_xinclude_nodes =
true;
65 bool fixup_base_uris =
false;
66 #if LIBXMLXX_MAJOR_VERSION == 2
67 #if LIBXMLXX_MINOR_VERSION < 42
68 doc->process_xinclude(generate_xinclude_nodes);
70 doc->process_xinclude(generate_xinclude_nodes, fixup_base_uris);
73 doc->process_xinclude(generate_xinclude_nodes, fixup_base_uris);
79 xmlpp::Element* root = doc->get_root_node();
80 NodeSet have_base = root->find(
"//*[@xml:base]");
81 NodeSet::iterator it = have_base.begin();
82 for (; it != have_base.end(); ++it) {
83 reinterpret_cast<xmlpp::Element*
>(*it)->remove_attribute(
"base",
"xml");
void parse_memory(const Glib::ustring &contents)
parse a relaxng schema xml file
bool Validate(const xmlpp::Document *doc)
validate an xml file agaisnt the given schema
For validating files received via IO.
void Validate(const std::stringstream &schema)
validates the file agaisnt a schema
virtual ~XMLParser()
destructor
void Init(const std::stringstream &input)
initializes a parser with an xml snippet
xmlpp::Document * Document()
Code providing rudimentary logging capability for the Cyclus core.
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
@ LEV_DEBUG5
debugging information - most verbose
xmlpp::Node::NodeSet NodeSet
xmlpp::Node::const_NodeList const_NodeList