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
20 * Basic implementations suitable for use as defaults for unrecognized content
\r
23 #if !defined(__xmltooling_unkelement_h__)
\r
24 #define __xmltooling_unkelement_h__
\r
26 #include "internal.h"
\r
27 #include "XMLObjectBuilder.h"
\r
28 #include "io/AbstractXMLObjectMarshaller.h"
\r
29 #include "io/AbstractXMLObjectUnmarshaller.h"
\r
33 #if defined (_MSC_VER)
\r
34 #pragma warning( push )
\r
35 #pragma warning( disable : 4250 4251 )
\r
38 namespace xmltooling {
\r
40 class XMLTOOL_DLLLOCAL UnknownElementImpl : public AbstractDOMCachingXMLObject
\r
43 UnknownElementImpl(const XMLCh* namespaceURI=NULL, const XMLCh* elementLocalName=NULL, const XMLCh* namespacePrefix=NULL)
\r
44 : AbstractDOMCachingXMLObject(namespaceURI, elementLocalName, namespacePrefix) {}
\r
48 XMLObject* clone() const;
\r
50 DOMElement* marshall(DOMDocument* document=NULL, MarshallingContext* ctx=NULL) const;
\r
51 DOMElement* marshall(DOMElement* parentElement, MarshallingContext* ctx=NULL) const;
\r
52 XMLObject* unmarshall(DOMElement* element, bool bindDocument=false);
\r
55 void setDocumentElement(DOMDocument* document, DOMElement* element) const {
\r
56 DOMElement* documentRoot = document->getDocumentElement();
\r
58 document->replaceChild(documentRoot, element);
\r
60 document->appendChild(element);
\r
63 mutable std::string m_xml;
\r
65 void serialize(std::string& s) const;
\r
68 class XMLTOOL_DLLLOCAL UnknownElementBuilder : public XMLObjectBuilder
\r
71 XMLObject* buildObject(const DOMElement* e=NULL) const {
\r
72 return new UnknownElementImpl();
\r
78 #if defined (_MSC_VER)
\r
79 #pragma warning( pop )
\r
82 #endif /* __xmltooling_unkelement_h__ */
\r