1 // Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by a apache 2.0 license that can be
3 // found in the LICENSE file.
5 #ifndef COMMON_PLUGINS_PLUGIN_XML_PARSER_H_
6 #define COMMON_PLUGINS_PLUGIN_XML_PARSER_H_
8 #include <libxml2/libxml/xmlreader.h>
15 namespace common_installer {
17 /** this class parse xml file*/
18 class PluginsXmlParser {
20 explicit PluginsXmlParser(const std::filesystem::path& path)
21 : path_(path), doc_ptr_(nullptr) {}
24 const std::vector<std::string>& tags_list();
28 const std::filesystem::path path_;
30 std::vector<std::string> tags_;
31 int NextChildElement(xmlTextReaderPtr reader, int depth);
33 class WrapperXMLReader {
35 WrapperXMLReader() : reader_(nullptr) {}
37 xmlTextReaderPtr Create(const xmlDocPtr doc_ptr_) {
38 reader_ = xmlReaderWalker(doc_ptr_);
41 virtual ~WrapperXMLReader() {
43 xmlFreeTextReader(reader_);
48 xmlTextReaderPtr reader_;
52 } // namespace common_installer
53 #endif // COMMON_PLUGINS_PLUGIN_XML_PARSER_H_