Handle variant element names, merge in wildcard class, add test cases.
[shibboleth/cpp-xmltooling.git] / xmltooling / impl / UnknownElement.h
index 1afb6e1..d13f22c 100644 (file)
 /**\r
  * @file UnknownElement.h\r
  * \r
- * Basic implementations suitable for use as defaults for unrecognized content\r
+ * Basic implementation suitable for use as default for unrecognized content\r
  */\r
 \r
 #if !defined(__xmltooling_unkelement_h__)\r
 #define __xmltooling_unkelement_h__\r
 \r
-#include "internal.h"\r
-#include "AbstractDOMCachingXMLObject.h"\r
-#include "XMLObjectBuilder.h"\r
-#include "io/Marshaller.h"\r
-#include "io/Unmarshaller.h"\r
+#include <xmltooling/XMLObjectBuilder.h>\r
+#include <xmltooling/io/AbstractXMLObjectMarshaller.h>\r
+#include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>\r
 \r
 #include <string>\r
 \r
@@ -39,9 +37,7 @@
 namespace xmltooling {\r
 \r
     /**\r
-     * Implementation class for unrecognized DOM elements.\r
-     * Purpose is to wrap the DOM and do any necessary caching/reconstruction\r
-     * when a DOM has to cross into a new document.\r
+     * Implements a thin wrapper around unknown DOM content.\r
      */\r
     class XMLTOOL_DLLLOCAL UnknownElementImpl : public AbstractDOMCachingXMLObject\r
     {\r
@@ -49,58 +45,13 @@ namespace xmltooling {
         UnknownElementImpl(const XMLCh* namespaceURI=NULL, const XMLCh* elementLocalName=NULL, const XMLCh* namespacePrefix=NULL)\r
             : AbstractDOMCachingXMLObject(namespaceURI, elementLocalName, namespacePrefix) {}\r
     \r
-        /**\r
-         * Overridden to ensure XML content of DOM isn't lost.\r
-         * \r
-         * @see DOMCachingXMLObject::releaseDOM()\r
-         */\r
         void releaseDOM();\r
 \r
-        /**\r
-          * @see XMLObject::clone()\r
-          */\r
         XMLObject* clone() const;\r
 \r
-    protected:\r
-        /**\r
-         * When needed, we can serialize the DOM into XML form and preserve it here.\r
-         */\r
-        std::string m_xml;\r
-\r
-        void serialize(std::string& s) const;\r
-    private:\r
-        friend class XMLTOOL_DLLLOCAL UnknownElementMarshaller;\r
-    };\r
-\r
-    /**\r
-     * Factory for UnknownElementImpl objects\r
-     */\r
-    class XMLTOOL_DLLLOCAL UnknownElementBuilder : public virtual XMLObjectBuilder\r
-    {\r
-    public:\r
-        /**\r
-         * @see XMLObjectBuilder::buildObject()\r
-         */\r
-        XMLObject* buildObject() const {\r
-            return new UnknownElementImpl();\r
-        }\r
-    };\r
-\r
-    /**\r
-     * Marshaller for UnknownElementImpl objects\r
-     */\r
-    class XMLTOOL_DLLLOCAL UnknownElementMarshaller : public virtual Marshaller\r
-    {\r
-    public:\r
-        /**\r
-         * @see Marshaller::marshall(XMLObject*,DOMDocument*, const MarshallingContext*)\r
-         */\r
-        DOMElement* marshall(XMLObject* xmlObject, DOMDocument* document=NULL, MarshallingContext* ctx=NULL) const;\r
-\r
-        /**\r
-         * @see Marshaller::marshall(XMLObject*,DOMElement*, const MarshallingContext* ctx)\r
-         */\r
-        DOMElement* marshall(XMLObject* xmlObject, DOMElement* parentElement, MarshallingContext* ctx=NULL) const;\r
+        DOMElement* marshall(DOMDocument* document=NULL, MarshallingContext* ctx=NULL) const;\r
+        DOMElement* marshall(DOMElement* parentElement, MarshallingContext* ctx=NULL) const;\r
+        XMLObject* unmarshall(DOMElement* element, bool bindDocument=false);\r
         \r
     protected:\r
         void setDocumentElement(DOMDocument* document, DOMElement* element) const {\r
@@ -110,19 +61,25 @@ namespace xmltooling {
             else\r
                 document->appendChild(element);\r
         }\r
+\r
+        mutable std::string m_xml;\r
+\r
+        void serialize(std::string& s) const;\r
     };\r
 \r
     /**\r
-     * Unmarshaller for UnknownElementImpl objects\r
+     * Factory for UnknownElementImpl objects.\r
      */\r
-    class XMLTOOL_DLLLOCAL UnknownElementUnmarshaller : public virtual Unmarshaller\r
+    class XMLTOOL_API UnknownElementBuilder : public XMLObjectBuilder\r
     {\r
     public:\r
-        /**\r
-         * @see Unmarshaller::unmarshall()\r
-         */\r
-        XMLObject* unmarshall(DOMElement* element, bool bindDocument=false) const;\r
+        UnknownElementImpl* buildObject(\r
+            const XMLCh* namespaceURI, const XMLCh* elementLocalName, const XMLCh* namespacePrefix=NULL\r
+            ) const {\r
+            return new UnknownElementImpl(namespaceURI,elementLocalName,namespacePrefix);\r
+        }\r
     };\r
+\r
 };\r
 \r
 #if defined (_MSC_VER)\r