2 * Licensed to the University Corporation for Advanced Internet
3 * Development, Inc. (UCAID) under one or more contributor license
4 * agreements. See the NOTICE file distributed with this work for
5 * additional information regarding copyright ownership.
7 * UCAID licenses this file to you under the Apache License,
8 * Version 2.0 (the "License"); you may not use this file except
9 * in compliance with the License. You may obtain a copy of the
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17 * either express or implied. See the License for the specific
18 * language governing permissions and limitations under the License.
22 * @file xmltooling/io/AbstractXMLObjectUnmarshaller.h
24 * A mix-in to implement object unmarshalling.
27 #ifndef __xmltooling_xmlunmarshaller_h__
28 #define __xmltooling_xmlunmarshaller_h__
30 #include <xmltooling/AbstractDOMCachingXMLObject.h>
32 #if defined (_MSC_VER)
33 #pragma warning( push )
34 #pragma warning( disable : 4250 4251 )
37 namespace xmltooling {
40 * A mix-in to implement object unmarshalling.
42 class XMLTOOL_API AbstractXMLObjectUnmarshaller : public virtual AbstractXMLObject
45 virtual ~AbstractXMLObjectUnmarshaller();
47 XMLObject* unmarshall(xercesc::DOMElement* element, bool bindDocument=false);
50 AbstractXMLObjectUnmarshaller();
53 * Unmarshalls the attributes from the given DOM Element into the XMLObject. If the attribute
54 * is an XML namespace declaration the namespace is added via XMLObject::addNamespace().
55 * If it is a schema type (xsi:type) the schema type is added via XMLObject::setSchemaType().
56 * All other attributes are passed to the processAttribute hook.
58 * @param domElement the DOM Element whose attributes will be unmarshalled
60 * @throws UnmarshallingException thrown if there is a problem unmarshalling an attribute
62 virtual void unmarshallAttributes(const xercesc::DOMElement* domElement);
65 * Unmarshalls a given Element's child nodes. The resulting XMLObject children and content
66 * are passed to processChildElement() or processText() for further processing.
68 * @param domElement the DOM Element whose children will be unmarshalled
70 * @throws UnmarshallingException thrown if an error occurs unmarshalling the child elements
72 virtual void unmarshallContent(const xercesc::DOMElement* domElement);
75 * Called after a child element has been unmarshalled so that it can be added to the parent XMLObject.
77 * @param child pointer to the child XMLObject
78 * @param childRoot root element of the child (must not be stored, just a hint)
80 * @throws UnmarshallingException thrown if there is a problem adding the child to the parent
82 virtual void processChildElement(XMLObject* child, const xercesc::DOMElement* childRoot);
85 * Called after an attribute has been unmarshalled so that it can be added to the XMLObject.
87 * @param attribute the attribute being unmarshalled
89 * @throws UnmarshallingException thrown if there is a problem adding the attribute to the XMLObject
91 virtual void processAttribute(const xercesc::DOMAttr* attribute);
96 #if defined (_MSC_VER)
97 #pragma warning( pop )
100 #endif /* __xmltooling_xmlunmarshaller_h__ */