c++ - 从 .docx 读取 theme1.xml,没有命名空间的属性

标签 c++ docx libopc

我正在制作一个 docx 阅读器(libopc 和 C++),当我想从 theme1.xml 获取次要和主要字体时遇到问题。问题是我不知道如何在没有它的情况下为属性编写命名空间:

<a:latin typeface="Calibri"/>

我尝试过:

mce_start_attribute(&reader, _X(""), _X("typeface")) {//type
    _majorFont = (char*) xmlTextReaderConstValue(reader.reader);
}mce_end_attribute(&reader);

和:

mce_start_attribute(&reader, _X("http://www.3w.org/2000/xmlns"), _X("typeface")) {//type
    _majorFont = (char*) xmlTextReaderConstValue(reader.reader);
}mce_end_attribute(&reader);

我得到了相同的结果:什么也没有。

任何建议。 提前致谢。

最佳答案

我自己回答。 检查libopc源代码后,解决方案是将mce_start_attribute宏中的命名空间值设置为NULL:

mce_start_attribute(&reader, NULL, _X("typeface")) {//type
    _majorFont = (char*) xmlTextReaderConstValue(reader.reader);
}mce_end_attribute(&reader);

关于c++ - 从 .docx 读取 theme1.xml,没有命名空间的属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14382319/

相关文章:

c++ - delete[] 是否调用析构函数?

c++ - Win32 API - 创建按钮帮助

c++ - 如何强制复制省略,为什么它不能与删除的复制构造函数一起使用?

c++ - 使用 C++/SDL2 加载图像 - "unhandled exception", "access violation reading location"

Java - 将 XML 文件转换为 Docx 文件

c# - Novacode DocX 固定 C# 中的表大小

python-3.x - python-docx : adding checkbox to . docx 不起作用