
#include "XercesDOMImplementationWrapper.hpp"



#include <xercesc/dom/DOMImplementation.hpp>



#include <xalanc/PlatformSupport/DOMStringHelper.hpp>



#include "XercesDOMException.hpp"



XALAN_CPP_NAMESPACE_BEGIN



XercesDOMImplementationWrapper::XercesDOMImplementationWrapper(DOMImplementationType*   theXercesDOMImplementation) :
    XalanDOMImplementation(),
    m_xercesNode(theXercesDOMImplementation)
{
    assert(theXercesDOMImplementation != 0);
}



XercesDOMImplementationWrapper::~XercesDOMImplementationWrapper()
{
}



XercesDOMImplementationWrapper::XercesDOMImplementationWrapper(const XercesDOMImplementationWrapper&    theSource) :
    XalanDOMImplementation(theSource),
    m_xercesNode(theSource.m_xercesNode)
{
}



XercesDOMImplementationWrapper*
XercesDOMImplementationWrapper::create(
            MemoryManager&          theManager,
            DOMImplementationType*  theXercesDOMImplementation)
{
    typedef XercesDOMImplementationWrapper  ThisType;

    XalanAllocationGuard    theGuard(theManager, theManager.allocate(sizeof(ThisType)));

    ThisType* const     theResult =
        new (theGuard.get()) ThisType(theXercesDOMImplementation);

    theGuard.release();

    return theResult;
}



bool
XercesDOMImplementationWrapper::hasFeature(
            const XalanDOMString&   feature,
            const XalanDOMString&   version)
{
    return m_xercesNode->hasFeature(feature.c_str(), version.c_str());
}



XalanDocumentType*
XercesDOMImplementationWrapper::createDocumentType(
            const XalanDOMString&   /* qualifiedName */,
            const XalanDOMString&   /* publicId */,
            const XalanDOMString&   /* systemId */)
{
    throw XercesDOMException(XercesDOMException::NO_MODIFICATION_ALLOWED_ERR);

    return 0;
}



XalanDocument*
XercesDOMImplementationWrapper::createDocument(
            const XalanDOMString&       /* namespaceURI */,
            const XalanDOMString&       /* qualifiedName */,
            const XalanDocumentType&    /* doctype */)
{
    throw XercesDOMException(XercesDOMException::NO_MODIFICATION_ALLOWED_ERR);

    return 0;
}



XALAN_CPP_NAMESPACE_END
