From f5b90f477199ecd86ab3925b3c576693552e12e8 Mon Sep 17 00:00:00 2001 From: cantor Date: Tue, 4 Apr 2006 03:40:06 +0000 Subject: [PATCH] Refactored simple content and child-handling into mixin classes. git-svn-id: https://svn.middleware.georgetown.edu/cpp-xmltooling/trunk@73 de75baf8-a10c-0410-a50a-987c0e22f00f --- .../AbstractAttributeExtensibleXMLObject.cpp | 10 +- xmltooling/AbstractAttributeExtensibleXMLObject.h | 5 +- ...ementProxy.cpp => AbstractChildlessElement.cpp} | 16 +-- xmltooling/AbstractChildlessElement.h | 68 +++++++++++++ xmltooling/AbstractComplexElement.cpp | 32 ++++++ xmltooling/AbstractComplexElement.h | 72 ++++++++++++++ xmltooling/AbstractDOMCachingXMLObject.cpp | 3 +- xmltooling/AbstractDOMCachingXMLObject.h | 5 +- xmltooling/AbstractElementProxy.h | 27 +++-- xmltooling/AbstractSimpleElement.h | 72 ++++++++++++++ xmltooling/AbstractXMLObject.cpp | 20 ++-- xmltooling/AbstractXMLObject.h | 34 ++----- xmltooling/ElementProxy.h | 17 +--- xmltooling/Makefile.am | 7 +- xmltooling/SimpleElement.h | 59 +++++++++++ xmltooling/XMLObjectBuilder.h | 14 --- xmltooling/XMLToolingConfig.cpp | 2 + xmltooling/base.h | 54 +++++----- xmltooling/exceptions.h | 9 +- xmltooling/impl/UnknownElement.h | 3 +- xmltooling/signature/KeyInfo.h | 49 ++++----- xmltooling/signature/impl/KeyInfoImpl.cpp | 109 +++++++++++---------- .../validation/AbstractValidatingXMLObject.cpp | 3 +- xmltooling/xmltooling.vcproj | 24 ++++- xmltoolingtest/ExceptionTest.h | 1 - xmltoolingtest/KeyInfoTest.h | 61 ++++++++++++ xmltoolingtest/Makefile.am | 1 + xmltoolingtest/MarshallingTest.h | 37 ++++--- xmltoolingtest/SignatureTest.h | 23 ++--- xmltoolingtest/UnmarshallingTest.h | 23 ++--- xmltoolingtest/XMLObjectBaseTestCase.h | 7 +- xmltoolingtest/data/KeyInfo1.xml | 1 + xmltoolingtest/xmltoolingtest.h | 2 + xmltoolingtest/xmltoolingtest.vcproj | 30 +++++- 34 files changed, 647 insertions(+), 253 deletions(-) rename xmltooling/{AbstractElementProxy.cpp => AbstractChildlessElement.cpp} (62%) create mode 100644 xmltooling/AbstractChildlessElement.h create mode 100644 xmltooling/AbstractComplexElement.cpp create mode 100644 xmltooling/AbstractComplexElement.h create mode 100644 xmltooling/AbstractSimpleElement.h create mode 100644 xmltooling/SimpleElement.h create mode 100644 xmltoolingtest/KeyInfoTest.h create mode 100644 xmltoolingtest/data/KeyInfo1.xml diff --git a/xmltooling/AbstractAttributeExtensibleXMLObject.cpp b/xmltooling/AbstractAttributeExtensibleXMLObject.cpp index 4052b6e..781b722 100644 --- a/xmltooling/AbstractAttributeExtensibleXMLObject.cpp +++ b/xmltooling/AbstractAttributeExtensibleXMLObject.cpp @@ -29,16 +29,10 @@ using namespace xmltooling; using namespace std; -class _release : public unary_function { -public: - void operator()(pair p) const { - XMLString::release(&(p.second)); - } -}; - AbstractAttributeExtensibleXMLObject::~AbstractAttributeExtensibleXMLObject() { - for_each(m_attributeMap.begin(),m_attributeMap.end(),_release()); + for (map::iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) + XMLString::release(&(i->second)); } AbstractAttributeExtensibleXMLObject::AbstractAttributeExtensibleXMLObject(const AbstractAttributeExtensibleXMLObject& src) diff --git a/xmltooling/AbstractAttributeExtensibleXMLObject.h b/xmltooling/AbstractAttributeExtensibleXMLObject.h index 964a1be..ca2b390 100644 --- a/xmltooling/AbstractAttributeExtensibleXMLObject.h +++ b/xmltooling/AbstractAttributeExtensibleXMLObject.h @@ -17,7 +17,7 @@ /** * @file AbstractAttributeExtensibleXMLObject.h * - * An abstract implementation of an AttributeExtensibleXMLObject + * AbstractXMLObject mixin that implements AttributeExtensibleXMLObject */ #ifndef __xmltooling_absattrextxmlobj_h__ @@ -35,7 +35,8 @@ namespace xmltooling { /** - * An abstract implementation of an AttributeExtensibleXMLObject. + * AbstractXMLObject mixin that implements AttributeExtensibleXMLObject. + * Inherit from this class to add support for attribute wildcarding. */ class XMLTOOL_API AbstractAttributeExtensibleXMLObject : public virtual AttributeExtensibleXMLObject, public virtual AbstractXMLObject { diff --git a/xmltooling/AbstractElementProxy.cpp b/xmltooling/AbstractChildlessElement.cpp similarity index 62% rename from xmltooling/AbstractElementProxy.cpp rename to xmltooling/AbstractChildlessElement.cpp index 989fc33..6063134 100644 --- a/xmltooling/AbstractElementProxy.cpp +++ b/xmltooling/AbstractChildlessElement.cpp @@ -15,23 +15,17 @@ */ /** - * AbstractElementProxy.cpp + * AbstractChildlessElement.cpp * - * Extension of AbstractDOMCachingXMLObject that implements an ElementProxy. + * Extension of AbstractXMLObject that implements childlessness */ #include "internal.h" -#include "AbstractElementProxy.h" +#include "AbstractChildlessElement.h" using namespace xmltooling; using namespace std; -void AbstractElementProxy::setTextContent(const XMLCh* value) -{ - m_value=prepareForAssignment(m_value,value); -} +// shared "empty" list of children for childless objects -ListOf(XMLObject) AbstractElementProxy::getXMLObjects() -{ - return ListOf(XMLObject)(this,m_children,NULL,m_children.end()); -} +list AbstractChildlessElement::m_no_children; diff --git a/xmltooling/AbstractChildlessElement.h b/xmltooling/AbstractChildlessElement.h new file mode 100644 index 0000000..f903885 --- /dev/null +++ b/xmltooling/AbstractChildlessElement.h @@ -0,0 +1,68 @@ +/* + * Copyright 2001-2006 Internet2 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file AbstractChildlessElement.h + * + * AbstractXMLObject mixin that blocks children + */ + +#ifndef __xmltooling_absnokids_h__ +#define __xmltooling_absnokids_h__ + +#include + +#if defined (_MSC_VER) + #pragma warning( push ) + #pragma warning( disable : 4250 4251 ) +#endif + +namespace xmltooling { + + /** + * AbstractXMLObject mixin that blocks children. + * Inherit from this class to implement a childless element. + */ + class XMLTOOL_API AbstractChildlessElement : public virtual AbstractXMLObject + { + public: + virtual ~AbstractChildlessElement() {} + + bool hasChildren() const { + return false; + } + + const std::list& getOrderedChildren() const { + return m_no_children; + } + + protected: + AbstractChildlessElement() {} + + /** Copy constructor. */ + AbstractChildlessElement(const AbstractChildlessElement& src) {} + + private: + static std::list m_no_children; + }; + +}; + +#if defined (_MSC_VER) + #pragma warning( pop ) +#endif + +#endif /* __xmltooling_absnokids_h__ */ diff --git a/xmltooling/AbstractComplexElement.cpp b/xmltooling/AbstractComplexElement.cpp new file mode 100644 index 0000000..af04251 --- /dev/null +++ b/xmltooling/AbstractComplexElement.cpp @@ -0,0 +1,32 @@ +/* +* Copyright 2001-2006 Internet2 + * +* Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * AbstractComplexElement.cpp + * + * Implementation of AbstractComplexElement. + */ + +#include "internal.h" +#include "AbstractComplexElement.h" + +#include + +using namespace xmltooling; + +AbstractComplexElement::~AbstractComplexElement() { + std::for_each(m_children.begin(), m_children.end(), cleanup()); +} diff --git a/xmltooling/AbstractComplexElement.h b/xmltooling/AbstractComplexElement.h new file mode 100644 index 0000000..a326359 --- /dev/null +++ b/xmltooling/AbstractComplexElement.h @@ -0,0 +1,72 @@ +/* + * Copyright 2001-2006 Internet2 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file AbstractComplexElement.h + * + * AbstractXMLObject mixin that implements children + */ + +#ifndef __xmltooling_abscomplexel_h__ +#define __xmltooling_abscomplexel_h__ + +#include + +#if defined (_MSC_VER) + #pragma warning( push ) + #pragma warning( disable : 4250 4251 ) +#endif + +namespace xmltooling { + + /** + * AbstractXMLObject mixin that implements children. + * Inherit from this class to implement an element with child objects. + * No unprotected access to them is supplied here. + */ + class XMLTOOL_API AbstractComplexElement : public virtual AbstractXMLObject + { + public: + virtual ~AbstractComplexElement(); + + bool hasChildren() const { + return !m_children.empty(); + } + + const std::list& getOrderedChildren() const { + return m_children; + } + + protected: + AbstractComplexElement() {} + + /** Copy constructor. */ + AbstractComplexElement(const AbstractComplexElement& src) {} + + /** + * Underlying list of child objects. + * Manages the lifetime of the children. + */ + std::list m_children; + }; + +}; + +#if defined (_MSC_VER) + #pragma warning( pop ) +#endif + +#endif /* __xmltooling_abscomplexel_h__ */ diff --git a/xmltooling/AbstractDOMCachingXMLObject.cpp b/xmltooling/AbstractDOMCachingXMLObject.cpp index 3eacc8a..53564ff 100644 --- a/xmltooling/AbstractDOMCachingXMLObject.cpp +++ b/xmltooling/AbstractDOMCachingXMLObject.cpp @@ -93,7 +93,8 @@ void AbstractDOMCachingXMLObject::releaseChildrenDOM(bool propagateRelease) cons "releasing cached DOM representation for children with propagation set to %s", propagateRelease ? "true" : "false" ); - for_each(m_children.begin(),m_children.end(),bind2nd(_release(),propagateRelease)); + const list& children=getOrderedChildren(); + for_each(children.begin(),children.end(),bind2nd(_release(),propagateRelease)); } } diff --git a/xmltooling/AbstractDOMCachingXMLObject.h b/xmltooling/AbstractDOMCachingXMLObject.h index f143695..fc740f3 100644 --- a/xmltooling/AbstractDOMCachingXMLObject.h +++ b/xmltooling/AbstractDOMCachingXMLObject.h @@ -17,7 +17,7 @@ /** * @file AbstractDOMCachingXMLObject.h * - * Extension of AbstractXMLObject that adds DOM caching methods + * AbstractXMLObject mixin that implements DOM caching */ #if !defined(__xmltooling_abstractdomxmlobj_h__) @@ -33,7 +33,8 @@ namespace xmltooling { /** - * Extension of AbstractXMLObject that adds DOM caching methods + * AbstractXMLObject mixin that implements DOM caching. + * Inherit from this class to implement standard DOM caching behavior. */ class XMLTOOL_API AbstractDOMCachingXMLObject : public virtual AbstractXMLObject { diff --git a/xmltooling/AbstractElementProxy.h b/xmltooling/AbstractElementProxy.h index 19bad7b..b8bd05f 100644 --- a/xmltooling/AbstractElementProxy.h +++ b/xmltooling/AbstractElementProxy.h @@ -17,13 +17,14 @@ /** * @file AbstractElementProxy.h * - * An abstract implementation of an ElementProxy + * AbstractXMLObject mixin that implements an open content model */ #ifndef __xmltooling_abseleproxy_h__ #define __xmltooling_abseleproxy_h__ -#include +#include +#include #include #if defined (_MSC_VER) @@ -34,34 +35,30 @@ namespace xmltooling { /** - * An abstract implementation of an ExtensibleXMLObject. + * AbstractXMLObject mixin that implements an open content model. + * Inherit from this class to merge both simple and complex content + * and expose the underlying child collection in read/write mode. */ - class XMLTOOL_API AbstractElementProxy : public virtual ElementProxy, public virtual AbstractXMLObject + class XMLTOOL_API AbstractElementProxy + : public virtual ElementProxy, public AbstractSimpleElement, public AbstractComplexElement { public: virtual ~AbstractElementProxy() {} - virtual const XMLCh* getTextContent() const { - return m_value; + virtual ListOf(XMLObject) getXMLObjects() { + return ListOf(XMLObject)(this,m_children,NULL,m_children.end()); } - - virtual void setTextContent(const XMLCh* value); - - virtual ListOf(XMLObject) getXMLObjects(); virtual const std::list& getXMLObjects() const { return m_children; } protected: - AbstractElementProxy() : m_value(NULL) {} + AbstractElementProxy() {} /** Copy constructor. */ AbstractElementProxy(const AbstractElementProxy& src) - : AbstractXMLObject(src), m_value(XMLString::replicate(src.m_value)) {} - - private: - XMLCh* m_value; + : AbstractXMLObject(src), AbstractSimpleElement(src) {} }; }; diff --git a/xmltooling/AbstractSimpleElement.h b/xmltooling/AbstractSimpleElement.h new file mode 100644 index 0000000..853da26 --- /dev/null +++ b/xmltooling/AbstractSimpleElement.h @@ -0,0 +1,72 @@ +/* + * Copyright 2001-2006 Internet2 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file AbstractSimpleElement.h + * + * AbstractXMLObject mixin that implements a simple string-based content model + */ + +#ifndef __xmltooling_abssimpleel_h__ +#define __xmltooling_abssimpleel_h__ + +#include +#include + +#if defined (_MSC_VER) + #pragma warning( push ) + #pragma warning( disable : 4250 4251 ) +#endif + +namespace xmltooling { + + /** + * AbstractXMLObject mixin that implements a simple string-based content model. + * Inherit from this class to support string-based element content. + */ + class XMLTOOL_API AbstractSimpleElement : public virtual SimpleElement, public virtual AbstractXMLObject + { + public: + virtual ~AbstractSimpleElement() { + XMLString::release(&m_value); + } + + virtual const XMLCh* getTextContent() const { + return m_value; + } + + virtual void setTextContent(const XMLCh* value) { + m_value=prepareForAssignment(m_value,value); + } + + protected: + AbstractSimpleElement() : m_value(NULL) {} + + /** Copy constructor. */ + AbstractSimpleElement(const AbstractSimpleElement& src) + : AbstractXMLObject(src), m_value(XMLString::replicate(src.m_value)) {} + + private: + XMLCh* m_value; + }; + +}; + +#if defined (_MSC_VER) + #pragma warning( pop ) +#endif + +#endif /* __xmltooling_abssimpleel_h__ */ diff --git a/xmltooling/AbstractXMLObject.cpp b/xmltooling/AbstractXMLObject.cpp index 780304a..23e563b 100644 --- a/xmltooling/AbstractXMLObject.cpp +++ b/xmltooling/AbstractXMLObject.cpp @@ -29,11 +29,6 @@ using namespace xmltooling; -AbstractXMLObject::~AbstractXMLObject() { - delete m_typeQname; - std::for_each(m_children.begin(), m_children.end(), cleanup()); -} - AbstractXMLObject::AbstractXMLObject(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) : m_log(&log4cpp::Category::getInstance(XMLTOOLING_LOGCAT".XMLObject")), m_parent(NULL), m_elementQname(nsURI, localName, prefix), m_typeQname(NULL) @@ -52,8 +47,21 @@ AbstractXMLObject::AbstractXMLObject(const AbstractXMLObject& src) m_typeQname=new QName(*src.m_typeQname); } -XMLObject* AbstractXMLObject::prepareForAssignment(XMLObject* oldValue, XMLObject* newValue) { +XMLCh* AbstractXMLObject::prepareForAssignment(XMLCh* oldValue, const XMLCh* newValue) +{ + XMLCh* newString = XMLString::replicate(newValue); + XMLString::trim(newString); + if (!XMLString::equals(oldValue,newValue)) { + releaseThisandParentDOM(); + XMLString::release(&oldValue); + return newString; + } + XMLString::release(&newString); + return oldValue; +} +XMLObject* AbstractXMLObject::prepareForAssignment(XMLObject* oldValue, XMLObject* newValue) +{ if (newValue && newValue->hasParent()) throw XMLObjectException("child XMLObject cannot be added - it is already the child of another XMLObject"); diff --git a/xmltooling/AbstractXMLObject.h b/xmltooling/AbstractXMLObject.h index 251a60f..5ead42f 100644 --- a/xmltooling/AbstractXMLObject.h +++ b/xmltooling/AbstractXMLObject.h @@ -34,11 +34,17 @@ namespace xmltooling { /** * An abstract implementation of XMLObject. + * This is the primary concrete base class, and supplies basic namespace, + * type, and parent handling. Most implementation classes should not + * directly inherit from this class, but rather from the various mixins + * that supply the rest of the XMLObject interface, as required. */ class XMLTOOL_API AbstractXMLObject : public virtual XMLObject { public: - virtual ~AbstractXMLObject(); + virtual ~AbstractXMLObject() { + delete m_typeQname; + } const QName& getElementQName() const { return m_elementQname; @@ -74,14 +80,6 @@ namespace xmltooling { m_parent = parent; } - bool hasChildren() const { - return !m_children.empty(); - } - - const std::list& getOrderedChildren() const { - return m_children; - } - protected: /** * Constructor @@ -109,17 +107,7 @@ namespace xmltooling { * * @return the value that should be assigned */ - XMLCh* prepareForAssignment(XMLCh* oldValue, const XMLCh* newValue) { - XMLCh* newString = XMLString::replicate(newValue); - XMLString::trim(newString); - if (!XMLString::equals(oldValue,newValue)) { - releaseThisandParentDOM(); - XMLString::release(&oldValue); - return newString; - } - XMLString::release(&newString); - return oldValue; - } + XMLCh* prepareForAssignment(XMLCh* oldValue, const XMLCh* newValue); /** * A helper function for derived classes, for assignment of (singleton) XML objects. @@ -138,12 +126,6 @@ namespace xmltooling { XMLObject* prepareForAssignment(XMLObject* oldValue, XMLObject* newValue); /** - * Underlying list of child objects. - * Manages the lifetime of the children. - */ - std::list m_children; - - /** * Set of namespaces associated with the object. */ mutable std::set m_namespaces; diff --git a/xmltooling/ElementProxy.h b/xmltooling/ElementProxy.h index 53b3d48..b62d7ab 100644 --- a/xmltooling/ElementProxy.h +++ b/xmltooling/ElementProxy.h @@ -23,6 +23,7 @@ #if !defined(__xmltooling_eleproxy_h__) #define __xmltooling_eleproxy_h__ +#include #include #include @@ -33,27 +34,13 @@ namespace xmltooling { /** * An XMLObject with an open content model. */ - class XMLTOOL_API ElementProxy : public virtual XMLObject + class XMLTOOL_API ElementProxy : public virtual SimpleElement { public: ElementProxy() {} virtual ~ElementProxy() {} /** - * Gets the text content of the object - * - * @return the text content, or NULL - */ - virtual const XMLCh* getTextContent() const=0; - - /** - * Sets (or clears) the text content of the object - * - * @param value value to set, or NULL to clear - */ - virtual void setTextContent(const XMLCh* value)=0; - - /** * Gets a mutable list of child objects * * @return mutable list of child objects diff --git a/xmltooling/Makefile.am b/xmltooling/Makefile.am index fa5ee26..315412f 100644 --- a/xmltooling/Makefile.am +++ b/xmltooling/Makefile.am @@ -16,8 +16,11 @@ valincludedir = $(includedir)/xmltooling/validation libxmltoolinginclude_HEADERS = \ AbstractAttributeExtensibleXMLObject.h \ + AbstractChildlessElement.h \ + AbstractComplexElement.h \ AbstractDOMCachingXMLObject.h \ AbstractElementProxy.h \ + AbstractSimpleElement.h \ AbstractXMLObject.h \ AttributeExtensibleXMLObject.h \ base.h \ @@ -27,6 +30,7 @@ libxmltoolinginclude_HEADERS = \ ILockable.h \ Namespace.h \ QName.h \ + SimpleElement.h \ unicode.h \ version.h \ XMLObject.h \ @@ -71,8 +75,9 @@ endif libxmltooling_la_SOURCES = \ AbstractAttributeExtensibleXMLObject.cpp \ + AbstractChildlessElement.cpp \ + AbstractComplexElement.cpp \ AbstractDOMCachingXMLObject.cpp \ - AbstractElementProxy.cpp \ AbstractXMLObject.cpp \ exceptions.cpp \ Namespace.cpp \ diff --git a/xmltooling/SimpleElement.h b/xmltooling/SimpleElement.h new file mode 100644 index 0000000..6386f4a --- /dev/null +++ b/xmltooling/SimpleElement.h @@ -0,0 +1,59 @@ +/* + * Copyright 2001-2006 Internet2 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file SimpleElement.h + * + * An XMLObject with a simple content model. + */ + +#ifndef __xmltooling_simpleel_h__ +#define __xmltooling_simpleel_h__ + +#include +#include + +using namespace xercesc; + +namespace xmltooling { + + /** + * An XMLObject with a simple content model. + */ + class XMLTOOL_API SimpleElement : public virtual XMLObject + { + public: + SimpleElement() {} + virtual ~SimpleElement() {} + + /** + * Gets the text content of the object + * + * @return the text content, or NULL + */ + virtual const XMLCh* getTextContent() const=0; + + /** + * Sets (or clears) the text content of the object + * + * @param value value to set, or NULL to clear + */ + virtual void setTextContent(const XMLCh* value)=0; + }; + +}; + +#endif /* __xmltooling_simpleel_h__ */ diff --git a/xmltooling/XMLObjectBuilder.h b/xmltooling/XMLObjectBuilder.h index 25fcbb7..0a3d6bb 100644 --- a/xmltooling/XMLObjectBuilder.h +++ b/xmltooling/XMLObjectBuilder.h @@ -96,20 +96,6 @@ namespace xmltooling { } /** - * Creates an empty XMLObject using the default build method, if a builder can be found. - * - * @param key the element key used to locate a builder - * @return the empty object or NULL if no builder is available - */ - static XMLObject* buildOne(const QName& key) { - const XMLObjectBuilder* b=getBuilder(key); - if (b) - return b->buildFromQName(key); - b=getDefaultBuilder(); - return b ? b->buildFromQName(key) : NULL; - } - - /** * Creates an unmarshalled XMLObject using the default build method, if a builder can be found. * * @param element the unmarshalling source diff --git a/xmltooling/XMLToolingConfig.cpp b/xmltooling/XMLToolingConfig.cpp index 80f844e..de0a677 100644 --- a/xmltooling/XMLToolingConfig.cpp +++ b/xmltooling/XMLToolingConfig.cpp @@ -238,6 +238,8 @@ bool XMLToolingInternalConfig::init() void XMLToolingInternalConfig::term() { XMLObjectBuilder::destroyBuilders(); + Validator::destroyValidators(); + XMLToolingException::deregisterFactories(); for (vector::reverse_iterator i=m_libhandles.rbegin(); i!=m_libhandles.rend(); i++) { #if defined(WIN32) diff --git a/xmltooling/base.h b/xmltooling/base.h index 43903d8..7e7eefa 100644 --- a/xmltooling/base.h +++ b/xmltooling/base.h @@ -356,39 +356,32 @@ } /** - * Declares abstract get/set methods for named XML element content. + * Declares aliased get/set methods for named XML element content. * * @param proper the proper name to label the element's content */ #define DECL_XMLOBJECT_CONTENT(proper) \ XMLTOOLING_DOXYGEN(Returns proper.) \ - virtual const XMLCh* get##proper() const=0; \ - XMLTOOLING_DOXYGEN(Sets proper.) \ - virtual void set##proper(const XMLCh* proper)=0 + const XMLCh* get##proper() const { \ + return getTextContent(); \ + } \ + XMLTOOLING_DOXYGEN(Sets or clears proper.) \ + void set##proper(const XMLCh* proper) { \ + setTextContent(proper); \ + } /** - * Implements get/set methods and a private member for named XML element content. - * - * @param proper the proper name to label the element's content + * Implements marshalling/unmarshalling for element content. */ -#define IMPL_XMLOBJECT_CONTENT(proper) \ - private: \ - XMLCh* m_##proper; \ - public: \ - const XMLCh* get##proper() const { \ - return m_##proper; \ - } \ - void set##proper(const XMLCh* proper) { \ - m_##proper = prepareForAssignment(m_##proper,proper); \ - } \ +#define IMPL_XMLOBJECT_CONTENT \ protected: \ void marshallElementContent(DOMElement* domElement) const { \ - if(get##proper()) { \ - domElement->appendChild(domElement->getOwnerDocument()->createTextNode(get##proper())); \ + if(getTextContent()) { \ + domElement->appendChild(domElement->getOwnerDocument()->createTextNode(getTextContent())); \ } \ } \ void processElementContent(const XMLCh* elementContent) { \ - set##proper(elementContent); \ + setTextContent(elementContent); \ } @@ -421,7 +414,7 @@ * @param desc documentation for class */ #define DECL_XMLOBJECT_SIMPLE(linkage,cname,proper,desc) \ - BEGIN_XMLOBJECT(linkage,cname,xmltooling::XMLObject,desc); \ + BEGIN_XMLOBJECT(linkage,cname,xmltooling::SimpleElement,desc); \ DECL_XMLOBJECT_CONTENT(proper); \ END_XMLOBJECT @@ -431,11 +424,12 @@ * * @param linkage linkage specifier for the class * @param cname the name of the XMLObject specialization - * @param proper the proper name to label the element's content */ -#define DECL_XMLOBJECTIMPL_SIMPLE(linkage,cname,proper) \ +#define DECL_XMLOBJECTIMPL_SIMPLE(linkage,cname) \ class linkage cname##Impl \ : public cname, \ + public xmltooling::AbstractSimpleElement, \ + public xmltooling::AbstractChildlessElement, \ public xmltooling::AbstractDOMCachingXMLObject, \ public xmltooling::AbstractValidatingXMLObject, \ public xmltooling::AbstractXMLObjectMarshaller, \ @@ -444,16 +438,15 @@ public: \ virtual ~cname##Impl() {} \ cname##Impl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) \ - : xmltooling::AbstractXMLObject(nsURI, localName, prefix, schemaType), m_##proper(NULL) { \ + : xmltooling::AbstractXMLObject(nsURI, localName, prefix, schemaType) { \ } \ cname##Impl(const cname##Impl& src) \ : xmltooling::AbstractXMLObject(src), \ + xmltooling::AbstractSimpleElement(src), \ xmltooling::AbstractDOMCachingXMLObject(src), \ - xmltooling::AbstractValidatingXMLObject(src), \ - m_##proper(XMLString::replicate(src.m_##proper)) { \ - } \ + xmltooling::AbstractValidatingXMLObject(src) {} \ IMPL_XMLOBJECT_CLONE(cname) \ - IMPL_XMLOBJECT_CONTENT(proper) \ + IMPL_XMLOBJECT_CONTENT \ } /** @@ -606,11 +599,10 @@ * * @param linkage linkage specifier for the class * @param cname the name of the XMLObject specialization - * @param proper the proper name to label the element's content */ -#define XMLOBJECTVALIDATOR_SIMPLE(linkage,cname,proper) \ +#define XMLOBJECTVALIDATOR_SIMPLE(linkage,cname) \ BEGIN_XMLOBJECTVALIDATOR(linkage,cname); \ - XMLOBJECTVALIDATOR_REQUIRE(cname,proper); \ + XMLOBJECTVALIDATOR_REQUIRE(cname,TextContent); \ END_XMLOBJECTVALIDATOR #include diff --git a/xmltooling/exceptions.h b/xmltooling/exceptions.h index 3ed1d6d..990c012 100644 --- a/xmltooling/exceptions.h +++ b/xmltooling/exceptions.h @@ -72,7 +72,7 @@ * @param name the exception class name * @param ns the exception class C++ namespace */ -#define REGISTER_EXCEPTION_FACTORY(name,ns) XMLToolingException::registerFactory(#ns".."#name,name##Factory) +#define REGISTER_EXCEPTION_FACTORY(name,ns) XMLToolingException::registerFactory(#ns"::"#name,name##Factory) #if defined (_MSC_VER) #pragma warning( push ) @@ -329,6 +329,13 @@ namespace xmltooling { m_factoryMap.erase(exceptionClass); } + /** + * Unregisters all factories. + */ + static void deregisterFactories() { + m_factoryMap.clear(); + } + private: typedef std::map ExceptionFactoryMap; static ExceptionFactoryMap m_factoryMap; diff --git a/xmltooling/impl/UnknownElement.h b/xmltooling/impl/UnknownElement.h index 4e2e03b..701bb8f 100644 --- a/xmltooling/impl/UnknownElement.h +++ b/xmltooling/impl/UnknownElement.h @@ -23,6 +23,7 @@ #if !defined(__xmltooling_unkelement_h__) #define __xmltooling_unkelement_h__ +#include #include #include #include @@ -38,7 +39,7 @@ namespace xmltooling { /// @cond off - class XMLTOOL_DLLLOCAL UnknownElementImpl : public AbstractDOMCachingXMLObject + class XMLTOOL_DLLLOCAL UnknownElementImpl : public AbstractChildlessElement, public AbstractDOMCachingXMLObject { public: UnknownElementImpl(const XMLCh* namespaceURI=NULL, const XMLCh* elementLocalName=NULL, const XMLCh* namespacePrefix=NULL) diff --git a/xmltooling/signature/KeyInfo.h b/xmltooling/signature/KeyInfo.h index f4280fd..c1c6358 100644 --- a/xmltooling/signature/KeyInfo.h +++ b/xmltooling/signature/KeyInfo.h @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -78,11 +79,10 @@ namespace xmlsignature { static const XMLCh TYPE_NAME[]; END_XMLOBJECT; - BEGIN_XMLOBJECT(XMLTOOL_API,KeyValue,xmltooling::XMLObject,XML Digital Signature version 20020212 KeyValue element); + BEGIN_XMLOBJECT(XMLTOOL_API,KeyValue,xmltooling::SimpleElement,XML Digital Signature version 20020212 KeyValue element); DECL_XMLOBJECT_CHILD(DSAKeyValue); DECL_XMLOBJECT_CHILD(RSAKeyValue); DECL_XMLOBJECT_CHILD(XMLObject); - DECL_XMLOBJECT_CONTENT(TextContent); /** KeyValueType local name */ static const XMLCh TYPE_NAME[]; END_XMLOBJECT; @@ -145,7 +145,7 @@ namespace xmlsignature { static const XMLCh TYPE_NAME[]; END_XMLOBJECT; - BEGIN_XMLOBJECT(XMLTOOL_API,KeyInfo,xmltooling::ElementProxy,XML Digital Signature version 20020212 KeyInfo element); + BEGIN_XMLOBJECT(XMLTOOL_API,KeyInfo,xmltooling::XMLObject,XML Digital Signature version 20020212 KeyInfo element); DECL_XMLOBJECT_ATTRIB(Id,ID); DECL_XMLOBJECT_CHILDREN(X509Data); DECL_XMLOBJECT_CHILDREN(KeyName); @@ -154,6 +154,7 @@ namespace xmlsignature { DECL_XMLOBJECT_CHILDREN(MgmtData); DECL_XMLOBJECT_CHILDREN(PGPData); DECL_XMLOBJECT_CHILDREN(SPKIData); + DECL_XMLOBJECT_CHILDREN(XMLObject); /** KeyInfoType local name */ static const XMLCh TYPE_NAME[]; END_XMLOBJECT; @@ -192,27 +193,27 @@ namespace xmlsignature { DECL_XMLSIGOBJECTBUILDER(KeyInfo); #ifdef XMLTOOLING_DECLARE_VALIDATORS - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,KeyName,Name); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,MgmtData,Data); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Modulus,Value); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Exponent,Value); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Seed,Value); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,PgenCounter,Value); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,P,Value); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Q,Value); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,G,Value); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Y,Value); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,J,Value); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,XPath,Expression); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509IssuerName,Name); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509SerialNumber,SerialNumber); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509SKI,Value); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509SubjectName,Name); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509Certificate,Value); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509CRL,Value); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,SPKISexp,Value); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,PGPKeyID,ID); - XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,PGPKeyPacket,Packet); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,KeyName); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,MgmtData); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Modulus); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Exponent); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Seed); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,PgenCounter); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,P); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Q); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,G); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Y); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,J); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,XPath); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509IssuerName); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509SerialNumber); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509SKI); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509SubjectName); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509Certificate); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509CRL); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,SPKISexp); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,PGPKeyID); + XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,PGPKeyPacket); BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,RSAKeyValue); XMLOBJECTVALIDATOR_REQUIRE(RSAKeyValue,Modulus); diff --git a/xmltooling/signature/impl/KeyInfoImpl.cpp b/xmltooling/signature/impl/KeyInfoImpl.cpp index eac57ad..58456ec 100644 --- a/xmltooling/signature/impl/KeyInfoImpl.cpp +++ b/xmltooling/signature/impl/KeyInfoImpl.cpp @@ -21,7 +21,10 @@ */ #include "internal.h" +#include "AbstractChildlessElement.h" +#include "AbstractComplexElement.h" #include "AbstractElementProxy.h" +#include "AbstractSimpleElement.h" #include "exceptions.h" #include "io/AbstractXMLObjectMarshaller.h" #include "io/AbstractXMLObjectUnmarshaller.h" @@ -43,6 +46,7 @@ using namespace std; namespace xmlsignature { class XMLTOOL_DLLLOCAL DSAKeyValueImpl : public DSAKeyValue, + public AbstractComplexElement, public AbstractDOMCachingXMLObject, public AbstractValidatingXMLObject, public AbstractXMLObjectMarshaller, @@ -128,6 +132,7 @@ namespace xmlsignature { }; class XMLTOOL_DLLLOCAL RSAKeyValueImpl : public RSAKeyValue, + public AbstractComplexElement, public AbstractDOMCachingXMLObject, public AbstractValidatingXMLObject, public AbstractXMLObjectMarshaller, @@ -173,6 +178,8 @@ namespace xmlsignature { }; class XMLTOOL_DLLLOCAL KeyValueImpl : public KeyValue, + public AbstractSimpleElement, + public AbstractComplexElement, public AbstractDOMCachingXMLObject, public AbstractValidatingXMLObject, public AbstractXMLObjectMarshaller, @@ -187,7 +194,8 @@ namespace xmlsignature { } KeyValueImpl(const KeyValueImpl& src) - : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) { + : AbstractXMLObject(src), AbstractSimpleElement(src), + AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) { init(); if (src.getDSAKeyValue()) setDSAKeyValue(src.getDSAKeyValue()->cloneDSAKeyValue()); @@ -195,11 +203,9 @@ namespace xmlsignature { setRSAKeyValue(src.getRSAKeyValue()->cloneRSAKeyValue()); if (src.getXMLObject()) setXMLObject(src.getXMLObject()->clone()); - setTextContent(src.getTextContent()); } void init() { - m_TextContent=NULL; m_DSAKeyValue=NULL; m_RSAKeyValue=NULL; m_XMLObject=NULL; @@ -217,7 +223,7 @@ namespace xmlsignature { IMPL_XMLOBJECT_CHILD(DSAKeyValue); IMPL_XMLOBJECT_CHILD(RSAKeyValue); IMPL_XMLOBJECT_CHILD(XMLObject); - IMPL_XMLOBJECT_CONTENT(TextContent); + IMPL_XMLOBJECT_CONTENT; protected: void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { @@ -241,7 +247,9 @@ namespace xmlsignature { public AbstractXMLObjectUnmarshaller { public: - virtual ~TransformImpl() {} + virtual ~TransformImpl() { + XMLString::release(&m_Algorithm); + } TransformImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_Algorithm(NULL) { @@ -265,22 +273,13 @@ namespace xmlsignature { IMPL_XMLOBJECT_CLONE(Transform); IMPL_XMLOBJECT_ATTRIB(Algorithm); IMPL_XMLOBJECT_CHILDREN(XPath,m_children.end()); + IMPL_XMLOBJECT_CONTENT; protected: void marshallAttributes(DOMElement* domElement) const { MARSHALL_XMLOBJECT_ATTRIB(Algorithm,ALGORITHM,NULL); } - void marshallElementContent(DOMElement* domElement) const { - if(getTextContent()) { - domElement->appendChild(domElement->getOwnerDocument()->createTextNode(getTextContent())); - } - } - - void processElementContent(const XMLCh* elementContent) { - setTextContent(elementContent); - } - void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { PROC_XMLOBJECT_CHILDREN(XPath,XMLConstants::XMLSIG_NS); @@ -298,6 +297,7 @@ namespace xmlsignature { }; class XMLTOOL_DLLLOCAL TransformsImpl : public Transforms, + public AbstractComplexElement, public AbstractDOMCachingXMLObject, public AbstractValidatingXMLObject, public AbstractXMLObjectMarshaller, @@ -331,13 +331,17 @@ namespace xmlsignature { }; class XMLTOOL_DLLLOCAL RetrievalMethodImpl : public RetrievalMethod, + public AbstractComplexElement, public AbstractDOMCachingXMLObject, public AbstractValidatingXMLObject, public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller { public: - virtual ~RetrievalMethodImpl() {} + virtual ~RetrievalMethodImpl() { + XMLString::release(&m_URI); + XMLString::release(&m_Type); + } RetrievalMethodImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { @@ -383,6 +387,7 @@ namespace xmlsignature { }; class XMLTOOL_DLLLOCAL X509IssuerSerialImpl : public X509IssuerSerial, + public AbstractComplexElement, public AbstractDOMCachingXMLObject, public AbstractValidatingXMLObject, public AbstractXMLObjectMarshaller, @@ -428,6 +433,7 @@ namespace xmlsignature { }; class XMLTOOL_DLLLOCAL X509DataImpl : public X509Data, + public AbstractComplexElement, public AbstractDOMCachingXMLObject, public AbstractValidatingXMLObject, public AbstractXMLObjectMarshaller, @@ -505,6 +511,7 @@ namespace xmlsignature { }; class XMLTOOL_DLLLOCAL SPKIDataImpl : public SPKIData, + public AbstractComplexElement, public AbstractDOMCachingXMLObject, public AbstractValidatingXMLObject, public AbstractXMLObjectMarshaller, @@ -568,6 +575,7 @@ namespace xmlsignature { }; class XMLTOOL_DLLLOCAL PGPDataImpl : public PGPData, + public AbstractComplexElement, public AbstractDOMCachingXMLObject, public AbstractValidatingXMLObject, public AbstractXMLObjectMarshaller, @@ -626,22 +634,29 @@ namespace xmlsignature { }; class XMLTOOL_DLLLOCAL KeyInfoImpl : public KeyInfo, + public AbstractComplexElement, + public AbstractSimpleElement, public AbstractDOMCachingXMLObject, - public AbstractElementProxy, public AbstractValidatingXMLObject, public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller { public: - virtual ~KeyInfoImpl() {} + virtual ~KeyInfoImpl() { + XMLString::release(&m_Id); + } KeyInfoImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_Id(NULL) { } KeyInfoImpl(const KeyInfoImpl& src) - : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractElementProxy(src), - AbstractValidatingXMLObject(src), m_Id(XMLString::replicate(src.m_Id)) { + : AbstractXMLObject(src), + AbstractDOMCachingXMLObject(src), + AbstractSimpleElement(src), + AbstractValidatingXMLObject(src), + m_Id(XMLString::replicate(src.m_Id)) { + for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { if (*i) { X509Data* xd=dynamic_cast(*i); @@ -700,22 +715,14 @@ namespace xmlsignature { IMPL_XMLOBJECT_CHILDREN(MgmtData,m_children.end()); IMPL_XMLOBJECT_CHILDREN(SPKIData,m_children.end()); IMPL_XMLOBJECT_CHILDREN(PGPData,m_children.end()); + IMPL_XMLOBJECT_CHILDREN(XMLObject,m_children.end()); + IMPL_XMLOBJECT_CONTENT; protected: void marshallAttributes(DOMElement* domElement) const { MARSHALL_XMLOBJECT_ID_ATTRIB(Id,ID,NULL); } - void marshallElementContent(DOMElement* domElement) const { - if(getTextContent()) { - domElement->appendChild(domElement->getOwnerDocument()->createTextNode(getTextContent())); - } - } - - void processElementContent(const XMLCh* elementContent) { - setTextContent(elementContent); - } - void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { PROC_XMLOBJECT_CHILDREN(X509Data,XMLConstants::XMLSIG_NS); PROC_XMLOBJECT_CHILDREN(KeyName,XMLConstants::XMLSIG_NS); @@ -738,27 +745,27 @@ namespace xmlsignature { } }; - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,KeyName,Name); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,MgmtData,Data); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,Modulus,Value); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,Exponent,Value); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,Seed,Value); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,PgenCounter,Value); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,P,Value); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,Q,Value); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,G,Value); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,Y,Value); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,J,Value); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,XPath,Expression); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,X509IssuerName,Name); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,X509SerialNumber,SerialNumber); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,X509SKI,Value); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,X509SubjectName,Name); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,X509Certificate,Value); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,X509CRL,Value); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,SPKISexp,Value); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,PGPKeyID,ID); - DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,PGPKeyPacket,Packet); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,KeyName); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,MgmtData); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,Modulus); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,Exponent); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,Seed); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,PgenCounter); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,P); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,Q); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,G); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,Y); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,J); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,XPath); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,X509IssuerName); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,X509SerialNumber); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,X509SKI); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,X509SubjectName); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,X509Certificate); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,X509CRL); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,SPKISexp); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,PGPKeyID); + DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,PGPKeyPacket); }; #if defined (_MSC_VER) diff --git a/xmltooling/validation/AbstractValidatingXMLObject.cpp b/xmltooling/validation/AbstractValidatingXMLObject.cpp index fb2bfde..dd9ccc5 100644 --- a/xmltooling/validation/AbstractValidatingXMLObject.cpp +++ b/xmltooling/validation/AbstractValidatingXMLObject.cpp @@ -86,6 +86,7 @@ void AbstractValidatingXMLObject::validate(bool validateDescendants) const } if (validateDescendants && hasChildren()) { - for_each(m_children.begin(),m_children.end(),bind2nd(_validate(),validateDescendants)); + const list& children=getOrderedChildren(); + for_each(children.begin(),children.end(),bind2nd(_validate(),validateDescendants)); } } diff --git a/xmltooling/xmltooling.vcproj b/xmltooling/xmltooling.vcproj index 768d15f..82490a1 100644 --- a/xmltooling/xmltooling.vcproj +++ b/xmltooling/xmltooling.vcproj @@ -186,11 +186,15 @@ > + + + + + + @@ -312,6 +324,10 @@ > + + @@ -352,6 +368,10 @@ > + + diff --git a/xmltoolingtest/ExceptionTest.h b/xmltoolingtest/ExceptionTest.h index d681577..70edcf4 100644 --- a/xmltoolingtest/ExceptionTest.h +++ b/xmltoolingtest/ExceptionTest.h @@ -44,7 +44,6 @@ public: params(1,"OpenSSLCryptoProvider::getRandom - OpenSSL random not properly initialised")); string buf=e7.toString(); - TS_TRACE(buf.c_str()); auto_ptr ptr(XMLToolingException::fromString(buf.c_str())); TS_ASSERT(typeid(*ptr)==typeid(MarshallingException)); TS_ASSERT(!strcmp(ptr->what(),"Foo is a bar.")); diff --git a/xmltoolingtest/KeyInfoTest.h b/xmltoolingtest/KeyInfoTest.h new file mode 100644 index 0000000..0d742ba --- /dev/null +++ b/xmltoolingtest/KeyInfoTest.h @@ -0,0 +1,61 @@ +/* + * Copyright 2001-2005 Internet2 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "XMLObjectBaseTestCase.h" + +#include +#include + +class KeyInfoTest : public CxxTest::TestSuite { +public: + KeyInfoTest() {} + + void setUp() { + XMLObjectBuilder::registerDefaultBuilder(new AnyElementBuilder()); + } + + void tearDown() { + XMLObjectBuilder::deregisterDefaultBuilder(); + } + + void testKeyInfo1() { + TS_TRACE("testKeyInfo1"); + + string path=data_path + "KeyInfo1.xml"; + ifstream fs(path.c_str()); + DOMDocument* doc=validatingPool->parse(fs); + TS_ASSERT(doc!=NULL); + + const XMLObjectBuilder* b = XMLObjectBuilder::getBuilder(doc->getDocumentElement()); + TS_ASSERT(b!=NULL); + + auto_ptr kiObject( + dynamic_cast(b->buildFromDocument(doc)) + ); + TS_ASSERT(kiObject.get()!=NULL); + TSM_ASSERT_EQUALS("Number of child elements was not expected value", + 3, kiObject->getOrderedChildren().size()); + TSM_ASSERT_EQUALS("Number of child elements was not expected value", + 1, kiObject->getKeyValues().size()); + TSM_ASSERT_EQUALS("Number of child elements was not expected value", + 1, kiObject->getX509Datas().front()->getX509Certificates().size()); + + auto_ptr_XMLCh expected("Public Key for CN=xmldap.org, OU=Domain Control Validated, O=xmldap.org"); + TSM_ASSERT_SAME_DATA("KeyName was not expected value", + expected.get(), kiObject->getKeyNames().front()->getName(), XMLString::stringLen(expected.get())); + } + +}; diff --git a/xmltoolingtest/Makefile.am b/xmltoolingtest/Makefile.am index ae00257..27ef988 100644 --- a/xmltoolingtest/Makefile.am +++ b/xmltoolingtest/Makefile.am @@ -17,6 +17,7 @@ endif xmltoolingtest_h = \ ComplexXMLObjectTest.h \ ExceptionTest.h \ + KeyInfoTest.h \ MarshallingTest.h \ UnmarshallingTest.h \ xmltoolingtest.h \ diff --git a/xmltoolingtest/MarshallingTest.h b/xmltoolingtest/MarshallingTest.h index a5f5091..8c0314d 100644 --- a/xmltoolingtest/MarshallingTest.h +++ b/xmltoolingtest/MarshallingTest.h @@ -19,28 +19,29 @@ #include class MarshallingTest : public CxxTest::TestSuite { - QName m_qname; - QName m_qtype; public: - MarshallingTest() : m_qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME,SimpleXMLObject::NAMESPACE_PREFIX), - m_qtype(SimpleXMLObject::NAMESPACE,SimpleXMLObject::TYPE_NAME,SimpleXMLObject::NAMESPACE_PREFIX) {} - void setUp() { - XMLObjectBuilder::registerBuilder(m_qname, new SimpleXMLObjectBuilder()); - XMLObjectBuilder::registerBuilder(m_qtype, new SimpleXMLObjectBuilder()); + QName qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME); + QName qtype(SimpleXMLObject::NAMESPACE,SimpleXMLObject::TYPE_NAME); + XMLObjectBuilder::registerBuilder(qname, new SimpleXMLObjectBuilder()); + XMLObjectBuilder::registerBuilder(qtype, new SimpleXMLObjectBuilder()); } void tearDown() { - XMLObjectBuilder::deregisterBuilder(m_qname); - XMLObjectBuilder::deregisterBuilder(m_qtype); + QName qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME); + QName qtype(SimpleXMLObject::NAMESPACE,SimpleXMLObject::TYPE_NAME); + XMLObjectBuilder::deregisterBuilder(qname); + XMLObjectBuilder::deregisterBuilder(qtype); } void testMarshallingWithAttributes() { TS_TRACE("testMarshallingWithAttributes"); - auto_ptr_XMLCh expected("Firefly"); - auto_ptr sxObject(dynamic_cast(XMLObjectBuilder::buildOne(m_qname))); + QName qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME); + const SimpleXMLObjectBuilder* b=dynamic_cast(XMLObjectBuilder::getBuilder(qname)); + auto_ptr sxObject(b->buildObject()); TS_ASSERT(sxObject.get()!=NULL); + auto_ptr_XMLCh expected("Firefly"); sxObject->setId(expected.get()); DOMElement* rootElement = sxObject->marshall(); @@ -57,9 +58,11 @@ public: void testMarshallingWithElementContent() { TS_TRACE("testMarshallingWithElementContent"); - auto_ptr_XMLCh expected("Sample Content"); - auto_ptr sxObject(dynamic_cast(XMLObjectBuilder::buildOne(m_qname))); + QName qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME); + const SimpleXMLObjectBuilder* b=dynamic_cast(XMLObjectBuilder::getBuilder(qname)); + auto_ptr sxObject(b->buildObject()); TS_ASSERT(sxObject.get()!=NULL); + auto_ptr_XMLCh expected("Sample Content"); sxObject->setValue(expected.get()); DOMElement* rootElement = sxObject->marshall(); @@ -76,7 +79,8 @@ public: void testMarshallingWithChildElements() { TS_TRACE("testMarshallingWithChildElements"); - const SimpleXMLObjectBuilder* b=dynamic_cast(XMLObjectBuilder::getBuilder(m_qname)); + QName qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME); + const SimpleXMLObjectBuilder* b=dynamic_cast(XMLObjectBuilder::getBuilder(qname)); TS_ASSERT(b!=NULL); auto_ptr sxObject(b->buildObject()); @@ -95,7 +99,10 @@ public: kids.erase(kids.begin()+1); TS_ASSERT_SAME_DATA(kids.back()->getValue(), bar.get(), XMLString::stringLen(bar.get())); - kids.push_back(b->buildObject(SimpleXMLObject::NAMESPACE,SimpleXMLObject::DERIVED_NAME,SimpleXMLObject::NAMESPACE_PREFIX,&m_qtype)); + QName qtype(SimpleXMLObject::NAMESPACE,SimpleXMLObject::TYPE_NAME,SimpleXMLObject::NAMESPACE_PREFIX); + kids.push_back( + b->buildObject(SimpleXMLObject::NAMESPACE,SimpleXMLObject::DERIVED_NAME,SimpleXMLObject::NAMESPACE_PREFIX,&qtype) + ); kids.back()->setValue(baz.get()); DOMElement* rootElement = sxObject->marshall(); diff --git a/xmltoolingtest/SignatureTest.h b/xmltoolingtest/SignatureTest.h index d626291..70db6b0 100644 --- a/xmltoolingtest/SignatureTest.h +++ b/xmltoolingtest/SignatureTest.h @@ -84,26 +84,26 @@ public: }; class SignatureTest : public CxxTest::TestSuite { - QName m_qname; - QName m_qtype; public: - SignatureTest() : m_qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME,SimpleXMLObject::NAMESPACE_PREFIX), - m_qtype(SimpleXMLObject::NAMESPACE,SimpleXMLObject::TYPE_NAME,SimpleXMLObject::NAMESPACE_PREFIX) {} - void setUp() { - XMLObjectBuilder::registerBuilder(m_qname, new SimpleXMLObjectBuilder()); - XMLObjectBuilder::registerBuilder(m_qtype, new SimpleXMLObjectBuilder()); + QName qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME); + QName qtype(SimpleXMLObject::NAMESPACE,SimpleXMLObject::TYPE_NAME); + XMLObjectBuilder::registerBuilder(qname, new SimpleXMLObjectBuilder()); + XMLObjectBuilder::registerBuilder(qtype, new SimpleXMLObjectBuilder()); } void tearDown() { - XMLObjectBuilder::deregisterBuilder(m_qname); - XMLObjectBuilder::deregisterBuilder(m_qtype); + QName qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME); + QName qtype(SimpleXMLObject::NAMESPACE,SimpleXMLObject::TYPE_NAME); + XMLObjectBuilder::deregisterBuilder(qname); + XMLObjectBuilder::deregisterBuilder(qtype); } void testSignature() { TS_TRACE("testSignature"); - const SimpleXMLObjectBuilder* b=dynamic_cast(XMLObjectBuilder::getBuilder(m_qname)); + QName qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME); + const SimpleXMLObjectBuilder* b=dynamic_cast(XMLObjectBuilder::getBuilder(qname)); TS_ASSERT(b!=NULL); auto_ptr sxObject(b->buildObject()); @@ -119,7 +119,8 @@ public: kids[1]->setValue(bar.get()); // Append a Signature. - Signature* sig=dynamic_cast(XMLObjectBuilder::buildOne(QName(XMLConstants::XMLSIG_NS,Signature::LOCAL_NAME))); + const SignatureBuilder* sigb=dynamic_cast(XMLObjectBuilder::getBuilder(QName(XMLConstants::XMLSIG_NS,Signature::LOCAL_NAME))); + Signature* sig=sigb->buildObject(); sxObject->setSignature(sig); // Signing context for the whole document. diff --git a/xmltoolingtest/UnmarshallingTest.h b/xmltoolingtest/UnmarshallingTest.h index 248671d..574c62a 100644 --- a/xmltoolingtest/UnmarshallingTest.h +++ b/xmltoolingtest/UnmarshallingTest.h @@ -53,20 +53,19 @@ const XMLCh SimpleXMLObject::ID_ATTRIB_NAME[] = { }; class UnmarshallingTest : public CxxTest::TestSuite { - QName m_qname; - QName m_qtype; public: - UnmarshallingTest() : m_qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME,SimpleXMLObject::NAMESPACE_PREFIX), - m_qtype(SimpleXMLObject::NAMESPACE,SimpleXMLObject::TYPE_NAME,SimpleXMLObject::NAMESPACE_PREFIX) {} - void setUp() { - XMLObjectBuilder::registerBuilder(m_qname, new SimpleXMLObjectBuilder()); - XMLObjectBuilder::registerBuilder(m_qtype, new SimpleXMLObjectBuilder()); + QName qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME); + QName qtype(SimpleXMLObject::NAMESPACE,SimpleXMLObject::TYPE_NAME); + XMLObjectBuilder::registerBuilder(qname, new SimpleXMLObjectBuilder()); + XMLObjectBuilder::registerBuilder(qtype, new SimpleXMLObjectBuilder()); } void tearDown() { - XMLObjectBuilder::deregisterBuilder(m_qname); - XMLObjectBuilder::deregisterBuilder(m_qtype); + QName qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME); + QName qtype(SimpleXMLObject::NAMESPACE,SimpleXMLObject::TYPE_NAME); + XMLObjectBuilder::deregisterBuilder(qname); + XMLObjectBuilder::deregisterBuilder(qtype); } void testUnmarshallingWithAttributes() { @@ -127,7 +126,8 @@ public: VectorOf(SimpleXMLObject) kids=sxObject->getSimpleXMLObjects(); TSM_ASSERT_EQUALS("Number of child elements was not expected value", 3, kids.size()); - TSM_ASSERT_EQUALS("Child's schema type was not expected value", m_qtype, *(kids.back()->getSchemaType())); + QName qtype(SimpleXMLObject::NAMESPACE,SimpleXMLObject::TYPE_NAME); + TSM_ASSERT_EQUALS("Child's schema type was not expected value", qtype, *(kids.back()->getSchemaType())); } void testUnmarshallingWithClone() { @@ -151,7 +151,8 @@ public: VectorOf(SimpleXMLObject) kids=clonedObject->getSimpleXMLObjects(); TSM_ASSERT_EQUALS("Number of child elements was not expected value", 3, kids.size()); - TSM_ASSERT_EQUALS("Child's schema type was not expected value", m_qtype, *(kids.back()->getSchemaType())); + QName qtype(SimpleXMLObject::NAMESPACE,SimpleXMLObject::TYPE_NAME); + TSM_ASSERT_EQUALS("Child's schema type was not expected value", qtype, *(kids.back()->getSchemaType())); } void testUnmarshallingWithUnknownChild() { diff --git a/xmltoolingtest/XMLObjectBaseTestCase.h b/xmltoolingtest/XMLObjectBaseTestCase.h index 6371026..7fe8100 100644 --- a/xmltoolingtest/XMLObjectBaseTestCase.h +++ b/xmltoolingtest/XMLObjectBaseTestCase.h @@ -15,6 +15,7 @@ */ #include +#include #include #include #include @@ -44,7 +45,11 @@ extern string data_path; #pragma warning( disable : 4250 4251 ) #endif -class SimpleXMLObject : public AbstractDOMCachingXMLObject, public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller +class SimpleXMLObject + : public AbstractComplexElement, + public AbstractDOMCachingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller { protected: SimpleXMLObject(const SimpleXMLObject& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), diff --git a/xmltoolingtest/data/KeyInfo1.xml b/xmltoolingtest/data/KeyInfo1.xml new file mode 100644 index 0000000..d323c44 --- /dev/null +++ b/xmltoolingtest/data/KeyInfo1.xml @@ -0,0 +1 @@ +Public Key for CN=xmldap.org, OU=Domain Control Validated, O=xmldap.orgANCxWwHKKOzwCtsbZUhhzQjXcyKHA7zrl8UqoCyu7haKzrEmI7udl7B6L+zxgnmVRz4zsw1PJsVYUt9zG6ABC+P7Xtx46Tk/h5gO6hWL4XBzFUuKwsMRZ0RB0sAv6iQtz6TCyH47OBSJSN24h7e/viUQ0ZtKYsJo/r8BHrnoiJk1AQABMIIEYTCCA8qgAwIBAgIDPbIoMA0GCSqGSIb3DQEBBQUAMIHsMQswCQYDVQQGEwJVUzEQMA4GA1UECBMHQXJpem9uYTETMBEGA1UEBxMKU2NvdHRzZGFsZTElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEwMC4GA1UECxMnaHR0cDovL3d3dy5zdGFyZmllbGR0ZWNoLmNvbS9yZXBvc2l0b3J5MTEwLwYDVQQDEyhTdGFyZmllbGQgU2VjdXJlIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MSowKAYJKoZIhvcNAQkBFhtwcmFjdGljZXNAc3RhcmZpZWxkdGVjaC5jb20wHhcNMDYwMzI5MjAwNzIxWhcNMDcwMzI5MjAwNzIxWjBNMRMwEQYDVQQKEwp4bWxkYXAub3JnMSEwHwYDVQQLExhEb21haW4gQ29udHJvbCBWYWxpZGF0ZWQxEzARBgNVBAMTCnhtbGRhcC5vcmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANCxWwHKKOzwCtsbZUhhzQjXcyKHA7zrl8UqoCyu7haKzrEmI7udl7B6L+zxgnmVRz4zsw1PJsVYUt9zG6ABC+P7Xtx46Tk/h5gO6hWL4XBzFUuKwsMRZ0RB0sAv6iQtz6TCyH47OBSJSN24h7e/viUQ0ZtKYsJo/r8BHrnoiJk1AgMBAAGjggGtMIIBqTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwVgYDVR0fBE8wTTBLoEmgR4ZFaHR0cDovL2NlcnRpZmljYXRlcy5zdGFyZmllbGR0ZWNoLmNvbS9yZXBvc2l0b3J5L3N0YXJmaWVsZGlzc3VpbmcuY3JsME8GA1UdIARIMEYwRAYLYIZIAYb4RQEHFwMwNTAzBggrBgEFBQcCARYnaHR0cDovL3d3dy5zdGFyZmllbGR0ZWNoLmNvbS9yZXBvc2l0b3J5MIGGBggrBgEFBQcBAQR6MHgwKQYIKwYBBQUHMAGGHWh0dHA6Ly9vY3NwLnN0YXJmaWVsZHRlY2guY29tMEsGCCsGAQUFBzAChj9odHRwOi8vY2VydGlmaWNhdGVzLnN0YXJmaWVsZHRlY2guY29tL3JlcG9zaXRvcnkvc2ZfaXNzdWluZy5jcnQwHQYDVR0OBBYEFMcfOhkD6X5rEFFGmj1aV4Rg7Nr9MB8GA1UdIwQYMBaAFKxV3rfqE+v8mGjiU2Ae8SU+jO7nMA0GCSqGSIb3DQEBBQUAA4GBAB0qT6gCXzgWua2P9/CPqsbXztwJAMPVx2zyAVYuZwgThsEmg53EhpqhUFz6DssNFzIxGT8vMrOMJs0hgndBTtWVfdJbrhbgtdc7/Zp10WO/6ioX3lIzJq+un2MA9Rdwk3QQyHCH9baYgHbcPEOj3N+dk2nzCzK34IbPpjYzE7H0 diff --git a/xmltoolingtest/xmltoolingtest.h b/xmltoolingtest/xmltoolingtest.h index fcf5a69..d63fccb 100644 --- a/xmltoolingtest/xmltoolingtest.h +++ b/xmltoolingtest/xmltoolingtest.h @@ -21,6 +21,8 @@ #include #include +//#define XMLTOOLINGTEST_LEAKCHECK + ParserPool* validatingPool=NULL; ParserPool* nonvalidatingPool=NULL; std::string data_path = "../xmltoolingtest/data/"; diff --git a/xmltoolingtest/xmltoolingtest.vcproj b/xmltoolingtest/xmltoolingtest.vcproj index 7a95632..843b5ae 100644 --- a/xmltoolingtest/xmltoolingtest.vcproj +++ b/xmltoolingtest/xmltoolingtest.vcproj @@ -188,6 +188,10 @@ > + + @@ -217,7 +221,7 @@ > @@ -226,7 +230,7 @@ > @@ -239,6 +243,28 @@ > + + + + + + + + -- 2.1.4