1 
  
   2 
  
   3 
  
   4 
  
   5 
  
   6 #include <sngxml/xml/XmlContentHandler.hpp>
  
   7 
  
   8 namespace sngxml { namespace xml {
  
   9 
  
  10 Attribute::Attribute(const std::u32string& namespaceUri_, const std::u32string& localName_, const std::u32string& qualifiedName_, const std::u32string& value_) :
  
  11     namespaceUri(namespaceUri_), localName(localName_), qualifiedName(qualifiedName_), value(value_)
  
  12 {
  
  13 }
  
  14 
  
  15 void Attributes::Add(const Attribute& attribute)
  
  16 {
  
  17     attributes.push_back(attribute);
  
  18 }
  
  19 
  
  20 void Attributes::Clear()
  
  21 {
  
  22     attributes.clear();
  
  23 }
  
  24 
  
  25 const std::u32string* Attributes::GetAttributeValue(const std::u32string& namespaceUri, const std::u32string& localName) const
  
  26 {
  
  27     for (const Attribute& attribute : attributes)
  
  28     {
  
  29         if (attribute.NamespaceUri() == namespaceUri && attribute.LocalName() == localName)
  
  30         {
  
  31             const std::u32string& value = attribute.Value();
  
  32             return &value;
  
  33         }
  
  34     }
  
  35     return nullptr;
  
  36 }
  
  37 
  
  38 const std::u32string* Attributes::GetAttributeValue(const std::u32string& qualifiedName) const
  
  39 {
  
  40     for (const Attribute& attribute : attributes)
  
  41     {
  
  42         if (attribute.QualifiedName() == qualifiedName)
  
  43         {
  
  44             const std::u32string& value = attribute.Value();
  
  45             return &value;
  
  46         }
  
  47     }
  
  48     return nullptr;
  
  49 }
  
  50 
  
  51 XmlContentHandler::~XmlContentHandler()
  
  52 {
  
  53 }
  
  54 
  
  55 } }