HCE project C++ developers source code library  1.1.1
HCE project developer library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
XMLCleaner.hpp
Go to the documentation of this file.
1 
16 #ifndef XML_CLEANER_HPP
17 #define XML_CLEANER_HPP
18 
19 #include <Poco/DOM/DOMParser.h>
20 #include <Poco/DOM/DOMWriter.h>
21 #include <Poco/DOM/Document.h>
22 #include <Poco/DOM/NodeIterator.h>
23 #include <Poco/DOM/NodeFilter.h>
24 #include <Poco/DOM/AutoPtr.h>
25 #include <Poco/DOM/NamedNodeMap.h>
26 #include <Poco/XML/XMLWriter.h>
27 #include <Poco/SAX/InputSource.h>
28 #include <Poco/SharedPtr.h>
29 
30 #include <set>
31 #include <string>
32 
33 enum class ResOmitType : std::uint8_t {ROM_NOT_OMIT = 0, ROM_EMPTY_OMIT = 1, ROM_NOT_NUM_OMIT = 2};
34 
36 {
37  private:
38  const std::string XMLPath;
39  const std::string elemName;
40  const std::string idName;
41  ResOmitType resOmitType;
42  protected:
43  std::string saveXML(Poco::XML::Node* node);
44  inline bool isOmitNode(const Poco::XML::XMLString &nodeValue);
45  public:
46  XMLCleaner(): XMLPath(""), elemName(""), idName(""), resOmitType(ResOmitType::ROM_NOT_OMIT) {}
47  XMLCleaner(const std::string &_XMLPath, const std::string &_elemName, const std::string &_idName, ResOmitType _resOmitType = ResOmitType::ROM_NOT_OMIT):
48  XMLPath(_XMLPath), elemName(_elemName), idName(_idName), resOmitType(_resOmitType) {}
49  void setOmitType(ResOmitType _resOmitType) {resOmitType = _resOmitType;}
50  ResOmitType getOmitType() {return resOmitType;}
51  std::string process(const std::string &inXML, const std::set<std::string> &delList);
52  virtual ~XMLCleaner() {};
53 };
54 
55 #endif