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 UnknownElement.h
\r
20 * Basic implementation suitable for use as default for unrecognized content
\r
23 #ifndef __xmltooling_unkelement_h__
\r
24 #define __xmltooling_unkelement_h__
\r
26 #include <xmltooling/AbstractChildlessElement.h>
\r
27 #include <xmltooling/exceptions.h>
\r
28 #include <xmltooling/XMLObjectBuilder.h>
\r
29 #include <xmltooling/io/AbstractXMLObjectMarshaller.h>
\r
30 #include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
\r
34 #if defined (_MSC_VER)
\r
35 #pragma warning( push )
\r
36 #pragma warning( disable : 4250 4251 )
\r
39 namespace xmltooling {
\r
42 class XMLTOOL_DLLLOCAL UnknownElementImpl : public AbstractChildlessElement, public AbstractDOMCachingXMLObject
\r
45 UnknownElementImpl(const XMLCh* namespaceURI=NULL, const XMLCh* elementLocalName=NULL, const XMLCh* namespacePrefix=NULL)
\r
46 : AbstractXMLObject(namespaceURI, elementLocalName, namespacePrefix) {}
\r
48 void releaseDOM() const;
\r
50 XMLObject* clone() const;
\r
52 DOMElement* marshall(
\r
53 DOMDocument* document=NULL
\r
54 #ifndef XMLTOOLING_NO_XMLSEC
\r
55 ,const std::vector<xmlsignature::Signature*>* sigs=NULL
\r
59 DOMElement* marshall(
\r
60 DOMElement* parentElement
\r
61 #ifndef XMLTOOLING_NO_XMLSEC
\r
62 ,const std::vector<xmlsignature::Signature*>* sigs=NULL
\r
65 XMLObject* unmarshall(DOMElement* element, bool bindDocument=false);
\r
68 void setDocumentElement(DOMDocument* document, DOMElement* element) const {
\r
69 DOMElement* documentRoot = document->getDocumentElement();
\r
71 document->replaceChild(element, documentRoot);
\r
73 document->appendChild(element);
\r
76 mutable std::string m_xml;
\r
78 void serialize(std::string& s) const;
\r
83 * Builder for UnknownElementImpl objects.
\r
84 * Use as the default builder when you want unknown DOM content treated as raw/ignored XML.
\r
86 class XMLTOOL_API UnknownElementBuilder : public XMLObjectBuilder
\r
89 XMLObject* buildObject(
\r
90 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const QName* schemaType=NULL
\r
96 #if defined (_MSC_VER)
\r
97 #pragma warning( pop )
\r
100 #endif /* __xmltooling_unkelement_h__ */
\r