From: cantor Date: Fri, 16 Oct 2009 02:11:38 +0000 (+0000) Subject: https://bugs.internet2.edu/jira/browse/CPPXT-45 X-Git-Tag: 1.4.1~171 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fxmltooling.git;a=commitdiff_plain;h=a344a3ff4d139606986493989b9a5bc4ed815582 https://bugs.internet2.edu/jira/browse/CPPXT-45 git-svn-id: https://svn.middleware.georgetown.edu/cpp-xmltooling/branches/REL_1@663 de75baf8-a10c-0410-a50a-987c0e22f00f --- diff --git a/xmltooling/base.h b/xmltooling/base.h index 827213a..6d4915d 100644 --- a/xmltooling/base.h +++ b/xmltooling/base.h @@ -604,6 +604,25 @@ } /** + * Implements get/set methods and a private member for a string XML attribute, + * plus a getXMLID override and attribute node clearance when DOM is dropped. + * + * @param proper the proper name of the attribute + * @param ucase the upcased name of the attribute + * @param namespaceURI the XML namespace of the attribute + */ +#define IMPL_ID_ATTRIB_EX(proper, ucase, namespaceURI) \ + IMPL_XMLOBJECT_ATTRIB(proper,XMLCh) \ + const XMLCh* getXMLID() const { \ + return m_##proper; \ + } \ + void releaseDOM() const { \ + if (getDOM()) \ + getDOM()->removeAttributeNS(namespaceURI, ucase##_ATTRIB_NAME); \ + AbstractDOMCachingXMLObject::releaseDOM(); \ + } + +/** * Implements get/set methods and a private member for a DateTime XML attribute. * * @param proper the proper name of the attribute diff --git a/xmltooling/encryption/impl/EncryptionImpl.cpp b/xmltooling/encryption/impl/EncryptionImpl.cpp index df2eda0..6843b4a 100644 --- a/xmltooling/encryption/impl/EncryptionImpl.cpp +++ b/xmltooling/encryption/impl/EncryptionImpl.cpp @@ -17,7 +17,7 @@ /** * EncryptionImpl.cpp * - * Implementation classes for XML Encryption schema + * Implementation classes for XML Encryption schema. */ #include "internal.h" @@ -284,7 +284,7 @@ namespace xmlencryption { } IMPL_XMLOBJECT_CLONE(EncryptionProperty); - IMPL_ID_ATTRIB(Id); + IMPL_ID_ATTRIB_EX(Id,ID,NULL); IMPL_STRING_ATTRIB(Target); IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject, m_children.end()); @@ -351,7 +351,7 @@ namespace xmlencryption { } IMPL_XMLOBJECT_CLONE(EncryptionProperties); - IMPL_ID_ATTRIB(Id); + IMPL_ID_ATTRIB_EX(Id,ID,NULL); IMPL_TYPED_CHILDREN(EncryptionProperty,m_children.end()); protected: @@ -559,7 +559,7 @@ namespace xmlencryption { } IMPL_XMLOBJECT_CLONE(EncryptedType); - IMPL_ID_ATTRIB(Id); + IMPL_ID_ATTRIB_EX(Id,ID,NULL); IMPL_STRING_ATTRIB(Type); IMPL_STRING_ATTRIB(MimeType); IMPL_STRING_ATTRIB(Encoding); diff --git a/xmltooling/signature/impl/KeyInfoImpl.cpp b/xmltooling/signature/impl/KeyInfoImpl.cpp index 9505365..d580130 100644 --- a/xmltooling/signature/impl/KeyInfoImpl.cpp +++ b/xmltooling/signature/impl/KeyInfoImpl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Internet2 + * Copyright 2001-2009 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ /** * KeyInfoImpl.cpp * - * Implementation classes for KeyInfo schema + * Implementation classes for KeyInfo schema. */ #include "internal.h" @@ -696,7 +696,7 @@ namespace xmlsignature { } IMPL_XMLOBJECT_CLONE(KeyInfo); - IMPL_ID_ATTRIB(Id); + IMPL_ID_ATTRIB_EX(Id,ID,NULL); IMPL_TYPED_CHILDREN(KeyName,m_children.end()); IMPL_TYPED_CHILDREN(KeyValue,m_children.end()); IMPL_TYPED_CHILDREN(RetrievalMethod,m_children.end());