diff --git a/exml/Declaration.h b/exml/Declaration.h index a237627..4673be7 100644 --- a/exml/Declaration.h +++ b/exml/Declaration.h @@ -18,6 +18,7 @@ namespace exml { public: Declaration(void) { }; + Declaration(const etk::UString& _version, const etk::UString& _format, const etk::UString& _validation) { }; virtual ~Declaration(void) { }; virtual nodeType_te GetType(void) const { return typeAttribute; }; virtual bool Generate(etk::UString& _data, int32_t _indent) const; diff --git a/exml/Element.cpp b/exml/Element.cpp index 9d38c62..9f9ee36 100644 --- a/exml/Element.cpp +++ b/exml/Element.cpp @@ -81,6 +81,7 @@ exml::Attribute* exml::Element::GetAttr(int32_t _id) } return m_listAttribute[_id]; } + const exml::Attribute* exml::Element::GetAttr(int32_t _id) const { if (_id <0 || _id>m_listAttribute.Size()) { @@ -88,6 +89,7 @@ const exml::Attribute* exml::Element::GetAttr(int32_t _id) const } return m_listAttribute[_id]; } + void exml::Element::AppendAttribute(exml::Attribute* _node) { if (_node == NULL) { @@ -118,6 +120,37 @@ const etk::UString& exml::Element::GetAttribute(const etk::UString& _name) const return errorReturn; } +void exml::Element::SetAttribute(const etk::UString& _name, const etk::UString& _value) +{ + // check if attribute already det : + for (int32_t iii=0; iiiGetName() == _name) { + // update the value : + m_listAttribute[iii]->SetValue(_value); + return; + } + } + exml::Attribute* attr = new exml::Attribute(_name, _value); + if (NULL==attr) { + EXML_ERROR("memory allocation error..."); + } + m_listAttribute.PushBack(attr); +} + +etk::UString exml::Element::GetText(void) +{ + // TODO : Add more capabilities ... + etk::UString res; + for (int32_t iii=0; iiiGenerate(res, 0); + } + } + return res; +} + + bool exml::Element::Generate(etk::UString& _data, int32_t _indent) const { AddIndent(_data, _indent); diff --git a/exml/Element.h b/exml/Element.h index 3dcc04b..52c4066 100644 --- a/exml/Element.h +++ b/exml/Element.h @@ -39,6 +39,9 @@ namespace exml Attribute* GetAttr(int32_t _id); const Attribute* GetAttr(int32_t _id) const; const etk::UString& GetAttribute(const etk::UString& _name) const; + void SetAttribute(const etk::UString& _name, const etk::UString& _value); + public: + etk::UString GetText(void); public: virtual bool Parse(const etk::UString& _data, int32_t& _pos, bool _caseSensitive, ivec2& _filePos); virtual bool Generate(etk::UString& _data, int32_t _indent) const;