00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef cxxtools_xml_StartElement_h
00027 #define cxxtools_xml_StartElement_h
00028
00029 #include <cxxtools/xml/api.h>
00030 #include <cxxtools/xml/node.h>
00031 #include <cxxtools/xml/namespace.h>
00032 #include <cxxtools/xml/namespacecontext.h>
00033 #include <cxxtools/string.h>
00034 #include <list>
00035
00036 namespace cxxtools {
00037
00038 namespace xml {
00039
00051 class CXXTOOLS_XML_API Attribute
00052 {
00053 public:
00055 Attribute();
00056
00063 Attribute(const String& name, const String& value);
00064
00066 virtual ~Attribute();
00067
00072 const String& name() const
00073 {return _name;}
00074
00075 String& name()
00076 {return _name;}
00077
00082 void setName(const String name)
00083 {_name = name;}
00084
00089 const String& value() const
00090 {return _value;}
00091
00092 String& value()
00093 {return _value;}
00094
00099 void setValue(const String value)
00100 {_value = value;}
00101
00102 void clear()
00103 { _name.clear(); _value.clear(); }
00104
00105 private:
00107 String _name;
00108
00110 String _value;
00111 };
00112
00113
00132 class CXXTOOLS_XML_API StartElement : public Node
00133 {
00134 public:
00136 StartElement();
00137
00144 StartElement(const String& name);
00145
00147 ~StartElement();
00148
00153 StartElement* clone() const
00154 {return new StartElement(*this);}
00155
00156
00157 void clear()
00158 {
00159 _name.clear();
00160 _attributes.clear();
00161 }
00162
00172 String& name() {return _name;}
00173
00183 const String& name() const
00184 {return _name;}
00185
00190 void setName(const String name)
00191 {_name = name;}
00192
00201 void addAttribute(const Attribute& attribute)
00202 {_attributes.push_back(attribute);}
00203
00214 const std::list<Attribute>& attributes() const
00215 {return _attributes;}
00216
00230 const String& attribute(const String attributeName) const;
00231
00241 bool hasAttribute(const String attributeName) const;
00242
00249 const NamespaceContext& namespaceContext() const
00250 {return _namespaceContext;}
00251
00258 void setNamespaceContext(const NamespaceContext& conText)
00259 {_namespaceContext = conText;}
00260
00271 const String& namespaceUri(const String& prefix) const
00272 {return _namespaceContext.namespaceUri(prefix);}
00273
00283 virtual bool operator==(const Node& node) const;
00284
00285 private:
00287 String _name;
00288
00290 std::list<Attribute> _attributes;
00291
00293 NamespaceContext _namespaceContext;
00294 };
00295
00296 }
00297
00298 }
00299
00300 #endif