5.2.20
08/25/2019

[#278] Xml attributes no ns without prefix
Summary Xml attributes no ns without prefix
Queue gloox
Queue Version 1.0.21
Type Bug
State Unconfirmed
Priority 1. Low
Owners
Requester drizt72 (at) zoho (dot) eu
Created 08/08/2018 (382 days ago)
Due
Updated 08/08/2018 (382 days ago)
Assigned
Resolved

History
08/08/2018 05:30:17 AM drizt72 (at) zoho (dot) eu Comment #1
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ Xml attributes no ns without prefix
Queue ⇒ gloox
Reply to this comment
This function returns parent xmlns for attribute without prefix. But 
in this case must be empty xmlns. See XML specification: 
https://stackoverflow.com/questions/3312390/xml-default-namespaces-for-unqualified-attribute-names

   const std::string Tag::Attribute::xmlns() const
   {
     if( !m_xmlns.empty() )
       return m_xmlns;

     if( m_parent )
       return m_parent->xmlns( m_prefix );

     return EmptyString;
   }

So correct code may be:

   const std::string Tag::Attribute::xmlns() const
   {
     if( !m_xmlns.empty() )
       return m_xmlns;

     if( m_parent && !m_prefix.empty() )
       return m_parent->xmlns( m_prefix );

     return EmptyString;
   }