27 : NumObjects(0), result(NULL), m_context(NULL)
29 put(expression, context);
33 : NumObjects(0), result(NULL), m_context(NULL)
38 if (expression[0] ==
'.')
44 std::array<char, 128> local;
45 if (std::snprintf(local.data(), local.size(),
".%s", expression) < 0)
46 throw std::runtime_error(
"Error generating expression");
55 xmlXPathFreeObject(
result);
68 xmlXPathFreeObject(
result);
69 result = xmlXPathEvalExpression((
const xmlChar*)expression, context);
70 if (xmlXPathNodeSetIsEmpty(
result->nodesetval))
95 m_doc = xmlNewDoc(BAD_CAST
"1.0");
96 m_root = xmlNewNode(NULL, BAD_CAST rootName.c_str());
113 xmlKeepBlanksDefault(1);
114 xmlAddChild(
m_root, newnode);
123 xmlAddChild(res[0], newnode);
129 xmlNodePtr
node = xmlNewChild(parent, NULL, BAD_CAST nodeName.c_str(), NULL);
134 #if defined(HAVE_MPI2) 146 std::ifstream is(xmlfile.c_str());
148 is.seekg(0, std::ios::end);
150 is.seekg(0, std::ios::beg);
152 buffer.resize(length);
154 is.read(buffer.data(), length);
161 buffer.resize(length);
164 m_doc = xmlParseMemory(buffer.data(), length);
176 InFileRoot = std::string(xmlfile, 0, xmlfile.size() - 4);
188 m_doc = xmlReadFile(xmlfile.c_str(), NULL, XML_PARSE_HUGE);
200 InFileRoot = std::string(xmlfile, 0, xmlfile.size() - 4);
212 m_doc = xmlReadMemory(data.data(), data.length(), NULL, NULL, XML_PARSE_HUGE);
if(!okay) throw std xmlNodePtr node
xmlXPathContextPtr getXPathContext()
void newDoc(const std::string &rootName)
Communicate * Controller
Global Communicator for a process.
class to handle xmlXPathObject
void put(const char *expression, xmlXPathContextPtr context)
evaluate the expression and create the object
xmlXPathContextPtr m_context
xmlXPathContextPtr m_context
bool parseFromString(const std::string_view data)
void addChild(xmlNodePtr newnode)
bool parse(const std::string &fname)
void dump(const std::string &newxml)