2 * Copyright 2001-2007 Internet2
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @file AbstractXMLObjectUnmarshaller.h
20 * A mix-in to implement object unmarshalling.
23 #ifndef __xmltooling_xmlunmarshaller_h__
24 #define __xmltooling_xmlunmarshaller_h__
26 #include <xmltooling/AbstractDOMCachingXMLObject.h>
28 #if defined (_MSC_VER)
29 #pragma warning( push )
30 #pragma warning( disable : 4250 4251 )
33 namespace xmltooling {
36 * A mix-in to implement object unmarshalling.
38 class XMLTOOL_API AbstractXMLObjectUnmarshaller : public virtual AbstractXMLObject
41 virtual ~AbstractXMLObjectUnmarshaller() {}
43 XMLObject* unmarshall(DOMElement* element, bool bindDocument=false);
46 AbstractXMLObjectUnmarshaller() {}
49 * Unmarshalls the attributes from the given DOM Element into the XMLObject. If the attribute
50 * is an XML namespace declaration the namespace is added via XMLObject::addNamespace().
51 * If it is a schema type (xsi:type) the schema type is added via XMLObject::setSchemaType().
52 * All other attributes are passed to the processAttribute hook.
54 * @param domElement the DOM Element whose attributes will be unmarshalled
56 * @throws UnmarshallingException thrown if there is a problem unmarshalling an attribute
58 virtual void unmarshallAttributes(const DOMElement* domElement);
61 * Unmarshalls a given Element's child nodes. The resulting XMLObject children and content
62 * are passed to processChildElement() or processText() for further processing.
64 * @param domElement the DOM Element whose children will be unmarshalled
66 * @throws UnmarshallingException thrown if an error occurs unmarshalling the child elements
68 virtual void unmarshallContent(const DOMElement* domElement);
71 * Called after a child element has been unmarshalled so that it can be added to the parent XMLObject.
73 * @param child pointer to the child XMLObject
74 * @param childRoot root element of the child (must not be stored, just a hint)
76 * @throws UnmarshallingException thrown if there is a problem adding the child to the parent
78 virtual void processChildElement(XMLObject* child, const DOMElement* childRoot);
81 * Called after an attribute has been unmarshalled so that it can be added to the XMLObject.
83 * @param attribute the attribute being unmarshalled
85 * @throws UnmarshallingException thrown if there is a problem adding the attribute to the XMLObject
87 virtual void processAttribute(const DOMAttr* attribute);
92 #if defined (_MSC_VER)
93 #pragma warning( pop )
96 #endif /* __xmltooling_xmlunmarshaller_h__ */