为什么 Xsd 无法加载转码服务?

Why Xsd Cannot Load a Transcoding Service?

我正在使用 CodeSynthesis XSD(XML C++ 数据绑定工具)从 .xsd 文件自动生成 .hpp 和 .cpp 文件。但是当 运行 xsd 在我的 .xsd 文件上时,我收到这个错误:

Could not load a transcoding service

我正在使用 openSUSE Leap-42.2、Xsd 4.0 和 Apache Xercess 3.1.4。详细消息如下:

Scanning dependencies of target XSDModel
[  2%] Generating C++/XML mapping
Could not load a transcoding service
lib/CMakeFiles/XSDModel.dir/build.make:51: recipe for target 'src/model/Model.cpp' failed
make[2]: *** [src/model/Model.cpp] Error 255
CMakeFiles/Makefile2:76: recipe for target 'lib/CMakeFiles/XSDModel.dir/all' failed
make[1]: *** [lib/CMakeFiles/XSDModel.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
[  2%] Generating C++/XML mapping
Could not load a transcoding service
lib/CMakeFiles/XSDModel.dir/build.make:51: recipe for target 'src/model/Model.cpp' failed
make[2]: *** [src/model/Model.cpp] Error 255
CMakeFiles/Makefile2:76: recipe for target 'lib/CMakeFiles/XSDModel.dir/all' failed
make[1]: *** [lib/CMakeFiles/XSDModel.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

编辑 1: 我用 --enable-transcoder-gnuiconvswitch 构建了 Apache Xercess,我的机器上也安装了 iconv

编辑 2: 经过一番挖掘,我发现 linux 上的 echo $LANG 命令打印了一个空行。此外,运行 localedef -i en_US -f UTF-8 en_US.UTF-8 打印此错误:

character map file `UTF-8' not found: No such file or directory
cannot read character map directory `/usr/share/i18n/charmaps': No such file or directory

在此 linux 上未定义语言环境。因此,只需设置一个语言环境:

$ export LANG=en_US.UTF-8

然后,一切都会好起来的。