开发者

error in one line Xerces program

The following application gives me an access violation on its first line, whats with that?

// test.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <xercesc/util/XMLString.hpp>

using namespace xercesc;

int main()
{

    XMLCh* path= XMLString::transcode("test.xml"); 

    return 0;
}

[edit] The following code gives me an exception on the XMLFormatTarget line, but if i change the string from "C:/test.xml" to "test.xml" it works fine.

// test.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/framework/LocalFileFormatTarget.hpp>

using namespace xercesc;

int main()
{
    XMLPlatformUtils::Initialize();

    XMLFormatTarget *formatTarg开发者_Python百科et = new LocalFileFormatTarget("C:/test.xml"); 

    return 0;
}


The obvious error in your program is that you are not initializing xerces-c before using it.

http://xerces.apache.org/xerces-c/program-2.html

You must call XMLPlatformUtils::Initialize() before making any other calls to xerces-c.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜