Reducing header overuse, non-inlining selected methods (CPPOST-35).
[shibboleth/cpp-xmltooling.git] / xmltooling / impl / UnknownElement.cpp
index bf5ed9c..9f68476 100644 (file)
@@ -1,5 +1,5 @@
 /*
-*  Copyright 2001-2007 Internet2
+*  Copyright 2001-2009 Internet2
  * 
 * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 /**
  * UnknownElement.cpp
  * 
- * Basic implementation suitable for use as default for unrecognized content
+ * Basic implementation suitable for use as default for unrecognized content.
  */
 
 #include "internal.h"
 #include "exceptions.h"
+#include "logging.h"
 #include "impl/UnknownElement.h"
 #include "util/NDC.h"
 #include "util/XMLHelper.h"
 
-#include <log4cpp/Category.hh>
 #include <xercesc/framework/MemBufInputSource.hpp>
 #include <xercesc/framework/Wrapper4InputSource.hpp>
 #include <xercesc/util/XMLUniDefs.hpp>
 
+using namespace xmltooling::logging;
 using namespace xmltooling;
-using namespace log4cpp;
+using namespace xercesc;
 using namespace std;
+#ifndef XMLTOOLING_NO_XMLSEC
+using xmlsignature::Signature;
+#endif
+
+UnknownElementImpl::UnknownElementImpl(const XMLCh* namespaceURI, const XMLCh* elementLocalName, const XMLCh* namespacePrefix)
+    : AbstractXMLObject(namespaceURI, elementLocalName, namespacePrefix)
+{
+}
+
+UnknownElementImpl::~UnknownElementImpl()
+{
+}
 
 void UnknownElementImpl::releaseDOM() const
 {
@@ -64,6 +77,25 @@ XMLObject* UnknownElementImpl::clone() const
     return ret;
 }
 
+const XMLCh* UnknownElementImpl::getTextContent(unsigned int position) const
+{
+    throw XMLObjectException("Direct access to content is not permitted.");
+}
+
+void UnknownElementImpl::setTextContent(const XMLCh*, unsigned int position)
+{
+    throw XMLObjectException("Direct access to content is not permitted.");
+}
+
+void UnknownElementImpl::setDocumentElement(DOMDocument* document, DOMElement* element) const
+{
+    DOMElement* documentRoot = document->getDocumentElement();
+    if (documentRoot)
+        document->replaceChild(element, documentRoot);
+    else
+        document->appendChild(element);
+}
+
 void UnknownElementImpl::serialize(string& s) const
 {
     if (getDOM())
@@ -73,7 +105,8 @@ void UnknownElementImpl::serialize(string& s) const
 DOMElement* UnknownElementImpl::marshall(
     DOMDocument* document
 #ifndef XMLTOOLING_NO_XMLSEC
-    ,const std::vector<xmlsignature::Signature*>* sigs
+    ,const vector<Signature*>* sigs
+    ,const Credential* credential
 #endif
     ) const
 {
@@ -140,7 +173,8 @@ DOMElement* UnknownElementImpl::marshall(
 DOMElement* UnknownElementImpl::marshall(
     DOMElement* parentElement
 #ifndef XMLTOOLING_NO_XMLSEC
-    ,const std::vector<xmlsignature::Signature*>* sigs
+    ,const vector<Signature*>* sigs
+    ,const Credential* credential
 #endif
     ) const
 {
@@ -199,8 +233,9 @@ XMLObject* UnknownElementImpl::unmarshall(DOMElement* element, bool bindDocument
 }
 
 XMLObject* UnknownElementBuilder::buildObject(
-    const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType
-    ) const {
+    const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType
+    ) const
+{
     return new UnknownElementImpl(nsURI,localName,prefix);
 }