summaryrefslogtreecommitdiffstats
blob: 54de04128f39d595f810425397e93f035d8d8432 (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
26
27
28
29
30
31
32
33
34
/*
 * Copyright (c) 2010-2016 Isode Limited.
 * All rights reserved.
 * See the COPYING file for more information.
 */

#pragma once

#include <map>
#include <memory>
#include <string>
#include <vector>

#include <Swiften/Base/API.h>
#include <Swiften/Serializer/XML/XMLNode.h>

namespace Swift {
    class SWIFTEN_API XMLElement : public XMLNode {
        public:
            typedef std::shared_ptr<XMLElement> ref;

            XMLElement(const std::string& tag, const std::string& xmlns = "", const std::string& text = "");

            void setAttribute(const std::string& attribute, const std::string& value);
            void addNode(std::shared_ptr<XMLNode> node);

            virtual std::string serialize();

        private:
            std::string tag_;
            std::map<std::string, std::string> attributes_;
            std::vector< std::shared_ptr<XMLNode> > childNodes_;
    };
}