Search code examples
c++xmlxerces

writing xml file with xercesc::DOMWriter


I am trying to write a xml file using xercesc::DOMWriter in c++. But I get a compilation error when writing the line:

xercesc::DOMWriter *theSerializer = ((xercesc::DOMImplementationLS*)impl1)->createDOMWriter();

error: DOMWriter is not a member of xercesc

I have the following includes:

#include <xercesc/util/TransService.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/dom/DOMAttr.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/framework/LocalFileInputSource.hpp>

what am I missing?


Solution

  • Use macro XERCES_CPP_NAMESPACE_USE to import symbols from Xerces's namespace to global namespace.

    Alternatively, you can use XERCES_CPP_NAMESPACE::