Change default namespace, support namespace remapping.
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Sat, 10 Feb 2007 06:21:37 +0000 (06:21 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Sat, 10 Feb 2007 06:21:37 +0000 (06:21 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@2163 cb58f699-b61c-0410-a6fe-9272a202ed29

shibsp/util/DOMPropertySet.cpp
shibsp/util/DOMPropertySet.h
shibsp/util/PropertySet.h

index 4212f7f..c9d2db9 100644 (file)
@@ -37,7 +37,7 @@ DOMPropertySet::~DOMPropertySet()
 {
     for (map<string,pair<char*,const XMLCh*> >::iterator i=m_map.begin(); i!=m_map.end(); i++)
         XMLString::release(&(i->second.first));
-    for_each(m_nested.begin(),m_nested.end(),xmltooling::cleanup_pair<string,DOMPropertySet>());
+    for_each(m_nested.begin(),m_nested.end(),cleanup_pair<string,DOMPropertySet>());
 }
 
 void DOMPropertySet::load(
@@ -63,15 +63,20 @@ void DOMPropertySet::load(
             auto_ptr_char ns(a->getNamespaceURI());
             auto_ptr_char name(a->getLocalName());
             const char* realname=name.get();
+            map<string,string>::const_iterator remap;
             if (remapper) {
-                map<string,string>::const_iterator remap=remapper->find(realname);
+                remap=remapper->find(realname);
                 if (remap!=remapper->end()) {
                     log.warn("remapping property (%s) to (%s)",realname,remap->second.c_str());
                     realname=remap->second.c_str();
                 }
             }
             if (ns.get()) {
-                m_map[string("{") + ns.get() + '}' + realname]=pair<char*,const XMLCh*>(val,a->getNodeValue());
+                remap=remapper->find(ns.get());
+                if (remap!=remapper->end())
+                    m_map[string("{") + remap->second.c_str() + '}' + realname]=pair<char*,const XMLCh*>(val,a->getNodeValue());
+                else
+                    m_map[string("{") + ns.get() + '}' + realname]=pair<char*,const XMLCh*>(val,a->getNodeValue());
                 log.debug("added property {%s}%s (%s)",ns.get(),realname,val);
             }
             else {
@@ -91,16 +96,22 @@ void DOMPropertySet::load(
         auto_ptr_char ns(e->getNamespaceURI());
         auto_ptr_char name(e->getLocalName());
         const char* realname=name.get();
+        map<string,string>::const_iterator remap;
         if (remapper) {
-            map<string,string>::const_iterator remap=remapper->find(realname);
+            remap=remapper->find(realname);
             if (remap!=remapper->end()) {
                 log.warn("remapping property set (%s) to (%s)",realname,remap->second.c_str());
                 realname=remap->second.c_str();
             }
         }
         string key;
-        if (ns.get())
-            key=string("{") + ns.get() + '}' + realname;
+        if (ns.get()) {
+            remap=remapper->find(ns.get());
+            if (remap!=remapper->end())
+                key=string("{") + remap->second.c_str() + '}' + realname;
+            else
+                key=string("{") + ns.get() + '}' + realname;
+        }
         else
             key=realname;
         if (m_nested.find(key)!=m_nested.end())
index 6e75418..b29b307 100644 (file)
@@ -43,7 +43,7 @@ namespace shibsp {
         std::pair<bool,const XMLCh*> getXMLString(const char* name, const char* ns=NULL) const;
         std::pair<bool,unsigned int> getUnsignedInt(const char* name, const char* ns=NULL) const;
         std::pair<bool,int> getInt(const char* name, const char* ns=NULL) const;
-        const PropertySet* getPropertySet(const char* name, const char* ns="urn:mace:shibboleth:target:config:1.0") const;
+        const PropertySet* getPropertySet(const char* name, const char* ns="urn:mace:shibboleth:sp:config:2.0") const;
 
         const xercesc::DOMElement* getElement() const {
             return m_root;
index fb5e085..cc20b60 100644 (file)
@@ -91,7 +91,7 @@ namespace shibsp {
          * @param ns    nested property set namespace, or NULL
          * @return the nested property set, or NULL
          */        
-        virtual const PropertySet* getPropertySet(const char* name, const char* ns="urn:mace:shibboleth:target:config:1.0") const=0;
+        virtual const PropertySet* getPropertySet(const char* name, const char* ns="urn:mace:shibboleth:sp:config:2.0") const=0;
         
         /**
          * Returns a DOM element representing the property container, if any.