2 * Copyright 2001-2010 Internet2
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file xmltooling/impl/UnknownElement.h
20 * Basic implementation suitable for use as default for unrecognized content.
23 #ifndef __xmltooling_unkelement_h__
24 #define __xmltooling_unkelement_h__
26 #include <xmltooling/AbstractSimpleElement.h>
27 #include <xmltooling/exceptions.h>
28 #include <xmltooling/XMLObjectBuilder.h>
29 #include <xmltooling/io/AbstractXMLObjectMarshaller.h>
30 #include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
34 #if defined (_MSC_VER)
35 #pragma warning( push )
36 #pragma warning( disable : 4250 4251 )
39 namespace xmltooling {
42 class XMLTOOL_DLLLOCAL UnknownElementImpl : public AbstractSimpleElement, public AbstractDOMCachingXMLObject
45 UnknownElementImpl(const XMLCh* namespaceURI=nullptr, const XMLCh* elementLocalName=nullptr, const XMLCh* namespacePrefix=nullptr);
47 virtual ~UnknownElementImpl();
49 void releaseDOM() const;
50 XMLObject* clone() const;
51 const XMLCh* getTextContent(unsigned int position=0) const;
52 void setTextContent(const XMLCh*, unsigned int position=0);
54 xercesc::DOMElement* marshall(
55 xercesc::DOMDocument* document=nullptr
56 #ifndef XMLTOOLING_NO_XMLSEC
57 ,const std::vector<xmlsignature::Signature*>* sigs=nullptr
58 ,const Credential* credential=nullptr
62 xercesc::DOMElement* marshall(
63 xercesc::DOMElement* parentElement
64 #ifndef XMLTOOLING_NO_XMLSEC
65 ,const std::vector<xmlsignature::Signature*>* sigs=nullptr
66 ,const Credential* credential=nullptr
69 XMLObject* unmarshall(xercesc::DOMElement* element, bool bindDocument=false);
72 void setDocumentElement(xercesc::DOMDocument* document, xercesc::DOMElement* element) const;
74 mutable std::string m_xml;
76 void serialize(std::string& s) const;
81 * Builder for UnknownElementImpl objects.
82 * Use as the default builder when you want unknown DOM content treated as raw/ignored XML.
84 class XMLTOOL_API UnknownElementBuilder : public XMLObjectBuilder
87 XMLObject* buildObject(
88 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const QName* schemaType=nullptr
94 #if defined (_MSC_VER)
95 #pragma warning( pop )
98 #endif /* __xmltooling_unkelement_h__ */