blob: 6bb79402896036d7a3693cf30b5ede98ee3be636 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include <pch.hpp>
#include "../xmlPresenter.h"
#include <libxml++/document.h>
class Create : public XmlDocMutator {
public:
Create(ScriptNodePtr s) :
XmlDocMutator(s),
xpath(s, "xpath"),
name(s, "name")
{
}
void mutateElement(xmlpp::Element * root) const
{
for (xmlpp::Node * n : root->find(xpath(NULL))) {
if (auto e = dynamic_cast<xmlpp::Element *>(n))
e->add_child_element(name(NULL));
}
}
Variable xpath;
Variable name;
};
NAMEDFACTORY("create", Create, XmlDocMutatorFactory);
|