Multi-line svn commit, see body.
[shibboleth/cpp-xmltooling.git] / xmltooling / io / AbstractXMLObjectUnmarshaller.h
index fb45191..80d0909 100644 (file)
  * A thread-safe abstract unmarshaller.\r
  */\r
 \r
-#if !defined(__xmltooling_xmlunmarshaller_h__)\r
+#ifndef __xmltooling_xmlunmarshaller_h__\r
 #define __xmltooling_xmlunmarshaller_h__\r
 \r
-#include <xmltooling/XMLObject.h>\r
-#include <xmltooling/io/Unmarshaller.h>\r
+#include <xmltooling/AbstractDOMCachingXMLObject.h>\r
+\r
+#if defined (_MSC_VER)\r
+    #pragma warning( push )\r
+    #pragma warning( disable : 4250 4251 )\r
+#endif\r
 \r
 namespace xmltooling {\r
 \r
     /**\r
      * A thread-safe abstract unmarshaller.\r
      */\r
-    class XMLTOOL_API AbstractXMLObjectUnmarshaller : public virtual Unmarshaller\r
+    class XMLTOOL_API AbstractXMLObjectUnmarshaller : public virtual AbstractXMLObject\r
     {\r
     public:\r
         virtual ~AbstractXMLObjectUnmarshaller() {}\r
 \r
-        /**\r
-         * @see Unmarshaller::unmarshall()\r
-         */\r
-        XMLObject* unmarshall(DOMElement* element, bool bindDocument=false) const;\r
-    \r
-        \r
+        XMLObject* unmarshall(DOMElement* element, bool bindDocument=false);\r
+            \r
     protected:\r
-        /**\r
-         * Constructor.\r
-         * \r
-         * @param targetNamespaceURI the namespace URI of either the schema type QName or element QName of the elements this\r
-         *            unmarshaller operates on\r
-         * @param targetLocalName the local name of either the schema type QName or element QName of the elements this\r
-         *            unmarshaller operates on\r
-         */\r
-        AbstractXMLObjectUnmarshaller(const XMLCh* targetNamespaceURI, const XMLCh* targetLocalName);\r
+        AbstractXMLObjectUnmarshaller() {}\r
 \r
         /**\r
-         * Checks that the given DOM Element's XSI type or namespace qualified element name matches the target QName of this\r
-         * unmarshaller.\r
-         * \r
-         * @param domElement the DOM element to check\r
-         * \r
-         * @throws UnmarshallingException thrown if the DOM Element does not match the target of this unmarshaller\r
-         */\r
-        void checkElementIsTarget(const DOMElement* domElement) const;\r
-        \r
-        /**\r
-         * Constructs the XMLObject that the given DOM Element will be unmarshalled into. If the DOM element has an XML\r
-         * Schema type defined this method will attempt to retrieve an XMLObjectBuilder using the schema type. If no\r
-         * schema type is present or no builder is registered for the schema type, the element's QName is used. Once\r
-         * the builder is found the XMLObject is created by invoking XMLObjectBuilder::buildObject().\r
-         * Extending classes may wish to override this logic if more than just schema type or element name\r
-         * (e.g. element attributes or content) need to be used to determine how to create the XMLObject.\r
-         * \r
-         * @param domElement the DOM Element the created XMLObject will represent\r
-         * @return the empty XMLObject that DOM Element can be unmarshalled into\r
-         * \r
-         * @throws UnmarshallingException thrown if there is now XMLObjectBuilder registered for the given DOM Element\r
-         */\r
-        virtual XMLObject* buildXMLObject(const DOMElement* domElement) const;\r
-        \r
-        /**\r
-         * Unmarshalls the attributes from the given DOM Element into the given XMLObject. If the attribute is an XML\r
-         * namespace declaration the namespace is added to the given element via XMLObject::addNamespace().\r
-         * If it is a schema type (xsi:type) the schema type is added to the element via XMLObject::setSchemaType().\r
+         * Unmarshalls the attributes from the given DOM Element into the XMLObject. If the attribute\r
+         * is an XML namespace declaration the namespace is added via XMLObject::addNamespace().\r
+         * If it is a schema type (xsi:type) the schema type is added via XMLObject::setSchemaType().\r
          * All other attributes are passed to the processAttribute hook.\r
          * \r
          * @param domElement the DOM Element whose attributes will be unmarshalled\r
-         * @param xmlObject the XMLObject that will recieve information from the DOM attribute\r
          * \r
          * @throws UnmarshallingException thrown if there is a problem unmarshalling an attribute\r
          */\r
-        virtual void unmarshallAttributes(const DOMElement* domElement, XMLObject* xmlObject) const;\r
+        virtual void unmarshallAttributes(const DOMElement* domElement);\r
 \r
         /**\r
-         * Unmarshalls a given Element's children. For each child an unmarshaller is retrieved using\r
-         * getUnmarshaller(). The unmarshaller is then used to unmarshall the child element and the\r
-         * resulting XMLObject is passed to processChildElement() for further processing.\r
+         * Unmarshalls a given Element's child nodes. The resulting XMLObject children and content\r
+         * are passed to processChildElement() or processText() for further processing.\r
          * \r
          * @param domElement the DOM Element whose children will be unmarshalled\r
-         * @param xmlObject the parent object of the unmarshalled children\r
          * \r
          * @throws UnmarshallingException thrown if an error occurs unmarshalling the child elements\r
          */\r
-        virtual void unmarshallChildElements(const DOMElement* domElement, XMLObject* xmlObject) const;\r
+        virtual void unmarshallContent(const DOMElement* domElement);\r
 \r
         /**\r
          * Called after a child element has been unmarshalled so that it can be added to the parent XMLObject.\r
          * \r
-         * @param parent the parent XMLObject\r
-         * @param child the child XMLObject\r
+         * @param child     pointer to the child XMLObject\r
+         * @param childRoot root element of the child (must not be stored, just a hint)\r
          * \r
          * @throws UnmarshallingException thrown if there is a problem adding the child to the parent\r
          */\r
-        virtual void processChildElement(XMLObject* parent, XMLObject* child) const=0;\r
+        virtual void processChildElement(XMLObject* child, const DOMElement* childRoot);\r
     \r
         /**\r
          * Called after an attribute has been unmarshalled so that it can be added to the XMLObject.\r
          * \r
-         * @param xmlObject the XMLObject\r
          * @param attribute the attribute being unmarshalled\r
          * \r
          * @throws UnmarshallingException thrown if there is a problem adding the attribute to the XMLObject\r
          */\r
-        virtual void processAttribute(XMLObject* xmlObject, const DOMAttr* attribute) const=0;\r
-    \r
-        /**\r
-         * Called if the element being unmarshalled contained textual content so that it can be added to the XMLObject.\r
-         * \r
-         * @param xmlObject XMLObject the content will be given to\r
-         * @param elementContent the Element's text content\r
-         */\r
-        virtual void processElementContent(XMLObject* xmlObject, const XMLCh* elementContent) const=0;\r
-\r
-        void* m_log;\r
-    private:\r
-        QName m_targetQName;\r
+        virtual void processAttribute(const DOMAttr* attribute);\r
     };\r
     \r
 };\r
 \r
+#if defined (_MSC_VER)\r
+    #pragma warning( pop )\r
+#endif\r
+\r
 #endif /* __xmltooling_xmlunmarshaller_h__ */\r