From 243d0fe5832e48df0500ea89530e956c1a5aa661 Mon Sep 17 00:00:00 2001 From: cantor Date: Sat, 10 Feb 2007 06:21:37 +0000 Subject: [PATCH] Change default namespace, support namespace remapping. git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@2163 cb58f699-b61c-0410-a6fe-9272a202ed29 --- shibsp/util/DOMPropertySet.cpp | 23 +++++++++++++++++------ shibsp/util/DOMPropertySet.h | 2 +- shibsp/util/PropertySet.h | 2 +- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/shibsp/util/DOMPropertySet.cpp b/shibsp/util/DOMPropertySet.cpp index 4212f7f..c9d2db9 100644 --- a/shibsp/util/DOMPropertySet.cpp +++ b/shibsp/util/DOMPropertySet.cpp @@ -37,7 +37,7 @@ DOMPropertySet::~DOMPropertySet() { for (map >::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()); + for_each(m_nested.begin(),m_nested.end(),cleanup_pair()); } 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::const_iterator remap; if (remapper) { - map::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(val,a->getNodeValue()); + remap=remapper->find(ns.get()); + if (remap!=remapper->end()) + m_map[string("{") + remap->second.c_str() + '}' + realname]=pair(val,a->getNodeValue()); + else + m_map[string("{") + ns.get() + '}' + realname]=pair(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::const_iterator remap; if (remapper) { - map::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()) diff --git a/shibsp/util/DOMPropertySet.h b/shibsp/util/DOMPropertySet.h index 6e75418..b29b307 100644 --- a/shibsp/util/DOMPropertySet.h +++ b/shibsp/util/DOMPropertySet.h @@ -43,7 +43,7 @@ namespace shibsp { std::pair getXMLString(const char* name, const char* ns=NULL) const; std::pair getUnsignedInt(const char* name, const char* ns=NULL) const; std::pair 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; diff --git a/shibsp/util/PropertySet.h b/shibsp/util/PropertySet.h index fb5e085..cc20b60 100644 --- a/shibsp/util/PropertySet.h +++ b/shibsp/util/PropertySet.h @@ -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. -- 2.1.4