Я не настолько опытен с c ++ и xerces lib, поэтому я хочу спросить, как я могу решить эту проблему. Я установил xerces lib, следуя инструкциям здесь .
#include <iostream>
#include <string>
#include <sstream>
//Mandatory for using any feature of Xerces.
#include <xercesc/util/PlatformUtils.hpp>
//Use the Document Object Model (DOM) API
#include <xercesc/dom/DOM.hpp>
//Required for outputing a Xerces DOMDocument to a standard output stream (Also see: XMLFormatTarget)
#include <xercesc/framework/StdOutFormatTarget.hpp>
//Required for outputing a Xerces DOMDocument to the file system (Also see: XMLFormatTarget)
#include <xercesc/framework/LocalFileFormatTarget.hpp>
/*
compile with g++ xerces.cc -o xml -lxerces-c
*/
using namespace std;
XERCES_CPP_NAMESPACE_USE
void write_output_to_stream(DOMDocument* measurement_DOM_document);
void write_output_to_file(DOMDocument* measurement_DOM_document, const wchar_t* full_file_path);
int main() {
XMLPlatformUtils::Initialize();
/* Pointer to our DOM implementation */
DOMImplementation* p_dom_implementation = DOMImplementationRegistry::getDOMImplementation(XMLString::transcode("core"));
/* */
DOMDocument* p_dom_document = p_dom_implementation->createDocument(0, L"dummy_measurements", 0);
DOMElement* p_root_element = p_dom_document->getDocumentElement();
XMLPlatformUtils::Terminate();
return 0;
}
Это еще не готовый код, я просто попытался скомпилировать. Выход компилятора:
xerces.cc: In function ‘int main()’:
xerces.cc:29:100: error: no matching function for call to ‘xercesc_3_2::DOMImplementation::createDocument(int, const wchar_t [19], int)’
DOMDocument* p_dom_document = p_dom_implementation->createDocument(0, L"dummy_measurements", 0);
^
In file included from /usr/local/include/xercesc/dom/DOM.hpp:41:0,
from xerces.cc:7:
/usr/local/include/xercesc/dom/DOMImplementation.hpp:174:26: note: candidate: virtual xercesc_3_2::DOMDocument* xercesc_3_2::DOMImplementation::createDocument(const XMLCh*, const XMLCh*, xercesc_3_2::DOMDocumentType*, xercesc_3_2::MemoryManager*)
virtual DOMDocument *createDocument(const XMLCh *namespaceURI,
^~~~~~~~~~~~~~
/usr/local/include/xercesc/dom/DOMImplementation.hpp:174:26: note: no known conversion for argument 2 from ‘const wchar_t [19]’ to ‘const XMLCh* {aka const char16_t*}’
/usr/local/include/xercesc/dom/DOMImplementation.hpp:214:26: note: candidate: virtual xercesc_3_2::DOMDocument* xercesc_3_2::DOMImplementation::createDocument(xercesc_3_2::MemoryManager*)
virtual DOMDocument *createDocument(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
^~~~~~~~~~~~~~
/usr/local/include/xercesc/dom/DOMImplementation.hpp:214:26: note: candidate expects 1 argument, 3 provided