Multi-line svn commit, see body.
[shibboleth/cpp-xmltooling.git] / xmltooling / io / AbstractXMLObjectUnmarshaller.h
1 /*\r
2 *  Copyright 2001-2006 Internet2\r
3  * \r
4 * Licensed under the Apache License, Version 2.0 (the "License");\r
5  * you may not use this file except in compliance with the License.\r
6  * You may obtain a copy of the License at\r
7  *\r
8  *     http://www.apache.org/licenses/LICENSE-2.0\r
9  *\r
10  * Unless required by applicable law or agreed to in writing, software\r
11  * distributed under the License is distributed on an "AS IS" BASIS,\r
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  * See the License for the specific language governing permissions and\r
14  * limitations under the License.\r
15  */\r
16 \r
17 /**\r
18  * @file AbstractXMLObjectUnmarshaller.h\r
19  * \r
20  * A thread-safe abstract unmarshaller.\r
21  */\r
22 \r
23 #ifndef __xmltooling_xmlunmarshaller_h__\r
24 #define __xmltooling_xmlunmarshaller_h__\r
25 \r
26 #include <xmltooling/AbstractDOMCachingXMLObject.h>\r
27 \r
28 #if defined (_MSC_VER)\r
29     #pragma warning( push )\r
30     #pragma warning( disable : 4250 4251 )\r
31 #endif\r
32 \r
33 namespace xmltooling {\r
34 \r
35     /**\r
36      * A thread-safe abstract unmarshaller.\r
37      */\r
38     class XMLTOOL_API AbstractXMLObjectUnmarshaller : public virtual AbstractXMLObject\r
39     {\r
40     public:\r
41         virtual ~AbstractXMLObjectUnmarshaller() {}\r
42 \r
43         XMLObject* unmarshall(DOMElement* element, bool bindDocument=false);\r
44             \r
45     protected:\r
46         AbstractXMLObjectUnmarshaller() {}\r
47 \r
48         /**\r
49          * Unmarshalls the attributes from the given DOM Element into the XMLObject. If the attribute\r
50          * is an XML namespace declaration the namespace is added via XMLObject::addNamespace().\r
51          * If it is a schema type (xsi:type) the schema type is added via XMLObject::setSchemaType().\r
52          * All other attributes are passed to the processAttribute hook.\r
53          * \r
54          * @param domElement the DOM Element whose attributes will be unmarshalled\r
55          * \r
56          * @throws UnmarshallingException thrown if there is a problem unmarshalling an attribute\r
57          */\r
58         virtual void unmarshallAttributes(const DOMElement* domElement);\r
59 \r
60         /**\r
61          * Unmarshalls a given Element's child nodes. The resulting XMLObject children and content\r
62          * are passed to processChildElement() or processText() for further processing.\r
63          * \r
64          * @param domElement the DOM Element whose children will be unmarshalled\r
65          * \r
66          * @throws UnmarshallingException thrown if an error occurs unmarshalling the child elements\r
67          */\r
68         virtual void unmarshallContent(const DOMElement* domElement);\r
69 \r
70         /**\r
71          * Called after a child element has been unmarshalled so that it can be added to the parent XMLObject.\r
72          * \r
73          * @param child     pointer to the child XMLObject\r
74          * @param childRoot root element of the child (must not be stored, just a hint)\r
75          * \r
76          * @throws UnmarshallingException thrown if there is a problem adding the child to the parent\r
77          */\r
78         virtual void processChildElement(XMLObject* child, const DOMElement* childRoot);\r
79     \r
80         /**\r
81          * Called after an attribute has been unmarshalled so that it can be added to the XMLObject.\r
82          * \r
83          * @param attribute the attribute being unmarshalled\r
84          * \r
85          * @throws UnmarshallingException thrown if there is a problem adding the attribute to the XMLObject\r
86          */\r
87         virtual void processAttribute(const DOMAttr* attribute);\r
88     };\r
89     \r
90 };\r
91 \r
92 #if defined (_MSC_VER)\r
93     #pragma warning( pop )\r
94 #endif\r
95 \r
96 #endif /* __xmltooling_xmlunmarshaller_h__ */\r