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/impl/UnknownElement.h
24 * Basic implementation suitable for use as default for unrecognized content.
27 #ifndef __xmltooling_unkelement_h__
28 #define __xmltooling_unkelement_h__
30 #include <xmltooling/AbstractSimpleElement.h>
31 #include <xmltooling/exceptions.h>
32 #include <xmltooling/XMLObjectBuilder.h>
33 #include <xmltooling/io/AbstractXMLObjectMarshaller.h>
34 #include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
38 #if defined (_MSC_VER)
39 #pragma warning( push )
40 #pragma warning( disable : 4250 4251 )
43 namespace xmltooling {
46 class XMLTOOL_DLLLOCAL UnknownElementImpl : public AbstractSimpleElement, public AbstractDOMCachingXMLObject
49 UnknownElementImpl(const XMLCh* namespaceURI=nullptr, const XMLCh* elementLocalName=nullptr, const XMLCh* namespacePrefix=nullptr);
51 virtual ~UnknownElementImpl();
53 void releaseDOM() const;
54 XMLObject* clone() const;
55 const XMLCh* getTextContent(unsigned int position=0) const;
56 void setTextContent(const XMLCh*, unsigned int position=0);
58 xercesc::DOMElement* marshall(
59 xercesc::DOMDocument* document=nullptr
60 #ifndef XMLTOOLING_NO_XMLSEC
61 ,const std::vector<xmlsignature::Signature*>* sigs=nullptr
62 ,const Credential* credential=nullptr
66 xercesc::DOMElement* marshall(
67 xercesc::DOMElement* parentElement
68 #ifndef XMLTOOLING_NO_XMLSEC
69 ,const std::vector<xmlsignature::Signature*>* sigs=nullptr
70 ,const Credential* credential=nullptr
73 XMLObject* unmarshall(xercesc::DOMElement* element, bool bindDocument=false);
76 void setDocumentElement(xercesc::DOMDocument* document, xercesc::DOMElement* element) const;
78 mutable std::string m_xml;
80 void serialize(std::string& s) const;
85 * Builder for UnknownElementImpl objects.
86 * Use as the default builder when you want unknown DOM content treated as raw/ignored XML.
88 class XMLTOOL_API UnknownElementBuilder : public XMLObjectBuilder
91 XMLObject* buildObject(
92 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const QName* schemaType=nullptr
98 #if defined (_MSC_VER)
99 #pragma warning( pop )
102 #endif /* __xmltooling_unkelement_h__ */