X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2Fimpl%2FUnknownElement.h;h=ce23b3133db5ea35a037541410c8d8367d8dc926;hb=77769b2e300d1295b8a5d717d9ede50e27d70cea;hp=0ad445df8f9377b4c00a2d7ea4ad0f347eda5f2f;hpb=53a2366efe13f4c6489f6c729e1b3de0f8057c12;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/impl/UnknownElement.h b/xmltooling/impl/UnknownElement.h index 0ad445d..ce23b31 100644 --- a/xmltooling/impl/UnknownElement.h +++ b/xmltooling/impl/UnknownElement.h @@ -15,14 +15,15 @@ */ /** - * @file UnknownElement.h + * @file xmltooling/impl/UnknownElement.h * * Basic implementation suitable for use as default for unrecognized content */ -#if !defined(__xmltooling_unkelement_h__) +#ifndef __xmltooling_unkelement_h__ #define __xmltooling_unkelement_h__ +#include #include #include #include @@ -37,28 +38,45 @@ namespace xmltooling { - /** - * Implements a thin wrapper around unknown DOM content. - */ - class XMLTOOL_DLLLOCAL UnknownElementImpl : public AbstractDOMCachingXMLObject + /// @cond off + class XMLTOOL_DLLLOCAL UnknownElementImpl : public AbstractSimpleElement, public AbstractDOMCachingXMLObject { public: UnknownElementImpl(const XMLCh* namespaceURI=NULL, const XMLCh* elementLocalName=NULL, const XMLCh* namespacePrefix=NULL) : AbstractXMLObject(namespaceURI, elementLocalName, namespacePrefix) {} - void releaseDOM(); + void releaseDOM() const; XMLObject* clone() const; - DOMElement* marshall(DOMDocument* document=NULL, MarshallingContext* ctx=NULL) const; - DOMElement* marshall(DOMElement* parentElement, MarshallingContext* ctx=NULL) const; + const XMLCh* getTextContent(unsigned int position=0) const { + throw XMLObjectException("Direct access to content is not permitted."); + } + + void setTextContent(const XMLCh*, unsigned int position=0) { + throw XMLObjectException("Direct access to content is not permitted."); + } + + DOMElement* marshall( + DOMDocument* document=NULL +#ifndef XMLTOOLING_NO_XMLSEC + ,const std::vector* sigs=NULL +#endif + ) const; + + DOMElement* marshall( + DOMElement* parentElement +#ifndef XMLTOOLING_NO_XMLSEC + ,const std::vector* sigs=NULL +#endif + ) const; XMLObject* unmarshall(DOMElement* element, bool bindDocument=false); protected: void setDocumentElement(DOMDocument* document, DOMElement* element) const { DOMElement* documentRoot = document->getDocumentElement(); if (documentRoot) - document->replaceChild(documentRoot, element); + document->replaceChild(element, documentRoot); else document->appendChild(element); } @@ -67,21 +85,18 @@ namespace xmltooling { void serialize(std::string& s) const; }; - + /// @endcond + /** * Builder for UnknownElementImpl objects. + * Use as the default builder when you want unknown DOM content treated as raw/ignored XML. */ class XMLTOOL_API UnknownElementBuilder : public XMLObjectBuilder { public: - /** - * @see XMLObjectBuilder::buildObject(const XMLCh*,const XMLCh*,const XMLCh*) - */ - UnknownElementImpl* buildObject( - const XMLCh* namespaceURI, const XMLCh* elementLocalName, const XMLCh* namespacePrefix=NULL - ) const { - return new UnknownElementImpl(namespaceURI,elementLocalName,namespacePrefix); - } + XMLObject* buildObject( + const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const QName* schemaType=NULL + ) const; }; };