40#ifndef DRAIN_TREE_UTILS_XML
41#define DRAIN_TREE_UTILS_XML
57 std::stringstream sstr;
58 sstr <<
"<" << node.getTag();
59 if (::atoi(node.getId().c_str())==0){
60 sstr <<
" id=" << node.getId();
62 if (node.getName().isValid()){
63 sstr <<
" name=" << node.getName();
65 if (!node.getClasses().empty()){
66 sstr <<
" class=[" << node.getClasses() <<
']';
72 const std::string & str()
const {
88 ALL = CHILDREN|TEXT|ATTRIBUTES,
99 typedef std::map<typename T::node_data_t::xml_tag_t, short unsigned int> tag_selector_t;
101 tag_selector_t tagSelector;
106 int visitPrefix(T & tree,
const typename T::path_t & path)
override {
110 int visitPostfix(T & tree,
const typename T::path_t & path)
override;
120 T & current = tree(path);
122 std::list<typename T::path_elem_t> empties;
124 for (
const auto & entry: current.getChildren()){
128 const T & child = entry.second;
130 if (child.getChildren().empty())
131 flagger.add(CHILDREN);
133 if (child.data.getAttributes().empty())
134 flagger.add(ATTRIBUTES);
136 if (child.data.getText().empty())
139 typename tag_selector_t::const_iterator it = tagSelector.find(child->getNativeType());
140 if (it != tagSelector.end()){
143 if (flagger.isSet(it->second)){
144 empties.push_back(entry.first);
167 for (
const typename T::path_elem_t & elem: empties){
180DRAIN_ENUM_DICT(drain::XmlEmptiness);
Definition TreeUtilsXML.h:51
Default default value...
Definition EnumFlags.h:247
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition Log.h:312
Definition TreeUtilsXML.h:94
int visitPrefix(T &tree, const typename T::path_t &path) override
Tasks to be executed before traversing child nodes.
Definition TreeUtilsXML.h:106
int visitPostfix(T &tree, const typename T::path_t &path) override
Tasks to be executed after traversing child nodes.
Definition TreeUtilsXML.h:117
Default implementation of a tree visitor (concept) compatible TreeUtils::traverser()
Definition TreeUtils.h:270
Definition DataSelector.cpp:1277