#include "XmlElement.h" XmlElement::XmlElement(const std::string& tagName) : mTagName(tagName), mChildren() { } std::shared_ptr XmlElement::Create(const std::string& tagName) { return std::make_shared(tagName); } void XmlElement::AddChild(std::shared_ptr child) { mChildren.push_back(child); } std::string XmlElement::GetTagName() const { return mTagName; } std::string XmlElement::GetText() const { return mText; } void XmlElement::SetText(const std::string& text) { mText = text; } void XmlElement::AddAttribute(XmlAttributePtr attribute) { mAttributes.push_back(attribute); } XmlAttributePtr XmlElement::GetAttribute(const std::string& attributeName) const { for(const auto& attribute : mAttributes) { if(attribute->GetName() == attributeName) { return attribute; } } return nullptr; } std::size_t XmlElement::GetNumAttributes() const { return mAttributes.size(); } std::vector XmlElement::GetAttributes() { return mAttributes; }