2 * Copyright 2001-2006 Internet2
\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
8 * http://www.apache.org/licenses/LICENSE-2.0
\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
18 * @file AbstractXMLObjectUnmarshaller.h
\r
20 * A thread-safe abstract unmarshaller.
\r
23 #ifndef __xmltooling_xmlunmarshaller_h__
\r
24 #define __xmltooling_xmlunmarshaller_h__
\r
26 #include <xmltooling/AbstractDOMCachingXMLObject.h>
\r
28 #if defined (_MSC_VER)
\r
29 #pragma warning( push )
\r
30 #pragma warning( disable : 4250 4251 )
\r
33 namespace xmltooling {
\r
36 * A thread-safe abstract unmarshaller.
\r
38 class XMLTOOL_API AbstractXMLObjectUnmarshaller : public virtual AbstractXMLObject
\r
41 virtual ~AbstractXMLObjectUnmarshaller() {}
\r
43 XMLObject* unmarshall(DOMElement* element, bool bindDocument=false);
\r
46 AbstractXMLObjectUnmarshaller() {}
\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
54 * @param domElement the DOM Element whose attributes will be unmarshalled
\r
56 * @throws UnmarshallingException thrown if there is a problem unmarshalling an attribute
\r
58 virtual void unmarshallAttributes(const DOMElement* domElement);
\r
61 * Unmarshalls a given Element's children. The resulting XMLObject child is passed to
\r
62 * processChildElement() for further processing.
\r
64 * @param domElement the DOM Element whose children will be unmarshalled
\r
66 * @throws UnmarshallingException thrown if an error occurs unmarshalling the child elements
\r
68 virtual void unmarshallChildElements(const DOMElement* domElement);
\r
71 * Called after a child element has been unmarshalled so that it can be added to the parent XMLObject.
\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
76 * @throws UnmarshallingException thrown if there is a problem adding the child to the parent
\r
78 virtual void processChildElement(XMLObject* child, const DOMElement* childRoot);
\r
81 * Called after an attribute has been unmarshalled so that it can be added to the XMLObject.
\r
83 * @param attribute the attribute being unmarshalled
\r
85 * @throws UnmarshallingException thrown if there is a problem adding the attribute to the XMLObject
\r
87 virtual void processAttribute(const DOMAttr* attribute) {}
\r
90 * Called if the element being unmarshalled contained textual content so that it can be added to the XMLObject.
\r
92 * @param elementContent the Element's text content
\r
94 virtual void processElementContent(const XMLCh* elementContent) {}
\r
99 #if defined (_MSC_VER)
\r
100 #pragma warning( pop )
\r
103 #endif /* __xmltooling_xmlunmarshaller_h__ */
\r