从.docx中读取theme1.xml,属性不带名称空间

Reading theme1.xml from a .docx, attribute without namespace

本文关键字:空间 属性 docx 读取 theme1 xml      更新时间:2023-10-16

我正在制作一个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);