Multi-line svn commit, see body.
[shibboleth/cpp-xmltooling.git] / xmltooling / impl / AnyElement.h
1 /*
2  *  Copyright 2001-2006 Internet2
3  * 
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 /**
18  * @file xmltooling/impl/AnyElement.h
19  * 
20  * Advanced anyType implementation suitable for deep processing of unknown content.
21  */
22
23 #if !defined(__xmltooling_anyelement_h__)
24 #define __xmltooling_anyelement_h__
25
26 #include <xmltooling/AbstractAttributeExtensibleXMLObject.h>
27 #include <xmltooling/AbstractElementProxy.h>
28 #include <xmltooling/XMLObjectBuilder.h>
29 #include <xmltooling/io/AbstractXMLObjectMarshaller.h>
30 #include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
31
32 #if defined (_MSC_VER)
33     #pragma warning( push )
34     #pragma warning( disable : 4250 4251 )
35 #endif
36
37 namespace xmltooling {
38
39     /**
40      * Implements a smart wrapper around unknown or arbitrary DOM content.
41      */
42     class XMLTOOL_API AnyElementImpl : public AbstractDOMCachingXMLObject,
43         public AbstractElementProxy,
44         public AbstractAttributeExtensibleXMLObject,
45         public AbstractXMLObjectMarshaller,
46         public AbstractXMLObjectUnmarshaller
47     {
48     public:
49         virtual ~AnyElementImpl() {}
50
51         AnyElementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const QName* schemaType=NULL)
52             : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
53         
54         XMLObject* clone() const;
55         
56     protected:
57         AnyElementImpl() {}
58         AnyElementImpl(const AnyElementImpl& src);   
59         
60         void marshallAttributes(DOMElement* domElement) const;
61         void processChildElement(XMLObject* childXMLObject, const DOMElement* root);
62         void processAttribute(const DOMAttr* attribute);
63     };
64
65     /**
66      * Builder for AnyElementImpl objects.
67      * Use as the default builder when you want to wrap each unknown element and
68      * process the DOM content through xmltooling interfaces. 
69      */
70     class XMLTOOL_API AnyElementBuilder : public XMLObjectBuilder
71     {
72     public:
73         XMLObject* buildObject(
74             const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const QName* schemaType=NULL
75             ) const;
76     };
77
78 };
79
80 #if defined (_MSC_VER)
81     #pragma warning( pop )
82 #endif
83
84 #endif /* __xmltooling_anyelement_h__ */