【问题标题】:Xerces-c assertion errorXerces -c 断言错误
【发布时间】:2011-05-05 18:23:34
【问题描述】:

我已经在 linux 上下载并构建了 Xerces-c:

Linux xxxx 2.6.24.7-server-3mnb #1 SMP Wed Sep 9 16:34:18 EDT 2009 x86_64 Intel(R) Xeon(R) CPU            3065  @ 2.33GHz GNU/Linux

创建了简单的程序:

#include <xercesc/sax2/XMLReaderFactory.hpp>
#include <xercesc/sax2/SAX2XMLReader.hpp>
#include <xercesc/sax2/DefaultHandler.hpp>
#include <xercesc/util/XMLUni.hpp>
//#include <xercesc/validators/common/Grammar.hpp>

   XERCES_CPP_NAMESPACE_USE;

int main(int argC, char *argv[])
{
    //  DefaultHandler handler;
    SAX2XMLReader *parser = XMLReaderFactory::createXMLReader();
    delete parser;
    return 0;
}

编译:

g++ -lcurl -o xtest test.cpp /usr/local/lib/libxerces-c.a

成功编译,运行它,这就是我得到的:

 ./xtest
xtest: xercesc/util/XMemory.cpp:63: static void* xercesc_3_1::XMemory::operator new(size_t, xercesc_3_1::MemoryManager*): Assertion `manager != 0' failed.
Aborted (core dumped)

任何人都有类似的经验/成功地构建和使用了这个库......怎么样?它正在成为一种真正的痛苦,显然它是 linux 唯一能够针对具有命名空间支持的多个模式正确验证 XML 文档的唯一方法(或者是吗??)

【问题讨论】:

    标签: c++ xml xerces xerces-c


    【解决方案1】:

    您在使用任何 xerces 功能之前似乎忘记致电 XMLPlatformUtils::Initialize

    必须在任何客户端代码中首先调用初始化。

    此外,一旦你完成了 xerces,即在程序结束时,不要忘记 XMLPlatformUtils::Terminate()。

    终止调用目前是可选的,以帮助那些动态加载解析器的人员在退出前进行清理,或者避免来自泄漏检测器的虚假报告。

    AFAIR 未能初始化 xerces 会导致您列出的错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多