3 *****************************************************************************
4 * Copyright (C) 2010 - 2011 Klagenfurt University
6 * Created on: Aug 10, 2010
7 * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
8 * Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published
12 * by the Free Software Foundation; either version 2.1 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
31 #include <vlc_common.h>
34 using namespace dash::xml;
36 const std::string Node::EmptyString = "";
44 for(size_t i = 0; i < this->subNodes.size(); i++)
45 delete(this->subNodes.at(i));
48 const std::vector<Node*>& Node::getSubNodes () const
50 return this->subNodes;
52 void Node::addSubNode (Node *node)
54 this->subNodes.push_back(node);
56 const std::string& Node::getName () const
60 void Node::setName (const std::string& name)
65 const std::string& Node::getAttributeValue (const std::string& key) const
67 std::map<std::string, std::string>::const_iterator it = this->attributes.find( key );
69 if ( it != this->attributes.end() )
74 void Node::addAttribute ( const std::string& key, const std::string& value)
76 this->attributes[key] = value;
78 std::vector<std::string> Node::getAttributeKeys () const
80 std::vector<std::string> keys;
81 std::map<std::string, std::string>::const_iterator it;
83 for(it = this->attributes.begin(); it != this->attributes.end(); ++it)
85 keys.push_back(it->first);
90 bool Node::hasText () const
95 const std::string& Node::getText () const
97 if ( this->type == XML_READER_TEXT )
101 assert( this->subNodes.size() == 1 );
102 return this->subNodes[0]->getText();
106 void Node::setText(const std::string &text)
111 const std::map<std::string,std::string>& Node::getAttributes () const
113 return this->attributes;
116 int Node::getType() const
121 void Node::setType(int type)