00001
00002
00003 #ifndef MIX_ELEMENT_H_
00004 #define MIX_ELEMENT_H_
00005
00006 #include "classes.h"
00007 #include "misc.h"
00008 #include "NodeContainer.h"
00009
00010 namespace MiX{
00016 template <class Char,class Traits,class XMLTraits>
00017 class Element
00018 : public NodeContainer<Char,Traits,XMLTraits>,
00019 public NamedNode<Char,Traits,XMLTraits>{
00020 public:
00021 MiX_Template_Typedef(Char,Traits,XMLTraits);
00022 typedef Element<Char,Traits,XMLTraits> this_type;
00023 typedef NodeContainer<Char,Traits,XMLTraits> nodecontainer_type;
00024 private:
00025 const static nodelist_type::iterator dmy_it;
00026 protected:
00033 Element(const string_type& name)
00034 : NodeContainer<Char,Traits,XMLTraits>(),
00035 NamedNode<Char,Traits,XMLTraits>(name){ };
00041 Element(const this_type& src){ };
00042 public:
00044 virtual ~Element()throw(){ };
00046 virtual NodeType getType()const{ return Node_Element; };
00052 static NodeType type(){ return Node_Element; };
00059 this_type& operator() (const string_type& name,int index=0){
00060 return getElement(name,index);
00061 };
00068 attribute_type& operator[] (const string_type& name){
00069 return getAttribute(name);
00070 };
00076 virtual XMLString<Char,Traits,XMLTraits> toString(bool is_indent=false,int indent_off=0)const;
00077
00079 string_type getText()const;
00080
00082 void setText(const XMLString<Char,Traits,XMLTraits>& s);
00083
00093 static this_type& create(const string_type& name,this_type& parent,const typename nodelist_type::iterator& it = dmy_it);
00094
00095 #ifdef MiX_BACKWARD_COMPATIBILITY
00096
00097 XMLString<Char,Traits,XMLTraits> getAllChildValue(){
00098 return getText();
00099 }
00100 #endif
00101
00102 friend class DOM_Parser<Char,Traits,XMLTraits>;
00103 friend class Document<Char,Traits,XMLTraits>;
00104 };
00105 }
00106
00107 #ifndef MIX_ELEMENT_CPP_
00108 #include "Element.cpp"
00109 #endif
00110
00111 #endif