summaryrefslogtreecommitdiffstats
blob: db746268415b418c566a8d13eb38a326cbbec0ce (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
35
/*
 * 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 = "");

            static std::string escapeAttributeValue(std::string value);
            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_;
    };
}