#include <xercesc/dom/DOM.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/dom/DOMImplementation.hpp>
#include <xercesc/dom/DOMImplementationLS.hpp>
#include <xercesc/framework/LocalFileFormatTarget.hpp>
#include <xercesc/framework/Wrapper4InputSource.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#if XERCES_VERSION_MAJOR > 2
typedef xercesc::DOMLSSerializer Writer;
typedef xercesc::DOMLSParser Parser;
#if defined(DEFINE_CASA_XERCES_STATICS)
static const XMLCh *fgDOMValidate = xercesc::XMLUni::fgDOMValidate;
inline Writer *create_writer(void *impl) { return static_cast<xercesc::DOMImplementationLS*>(impl)->createLSSerializer( ); }
inline Parser *create_parser(void *impl) { return static_cast<xercesc::DOMImplementationLS*>(impl)->createLSParser(xercesc::DOMImplementationLS::MODE_SYNCHRONOUS,0 ); }
inline XMLCh *write_to_string( Writer *writer, xercesc::DOMNode *n ) { return writer->writeToString(n); }
inline xercesc::DOMDocument *dom_parse( Parser *parser, const xercesc::Wrapper4InputSource &source ) { return parser->parse(&source); }
inline bool write_to_file( Writer *writer, xercesc::DOMNode *n, std::string file, const XMLCh * const encoding ) {
xercesc::DOMImplementation* impl=xercesc::DOMImplementationRegistry::getDOMImplementation(xercesc::XMLString::transcode("LS"));
xercesc::DOMLSOutput *sink = static_cast<xercesc::DOMImplementationLS*>(impl)->createLSOutput();
xercesc::LocalFileFormatTarget fileTarget(file.c_str());
sink->setEncoding(encoding);
sink->setByteStream(&fileTarget);
bool result = writer->write(n,sink);
inline bool can_set_parameter( Parser *parser, const XMLCh *name, T value ) { return parser->getDomConfig()->canSetParameter(name,value); }