哪种 XSLT 处理器适用于 C++?
我一开始使用的是 C++ 的 Xalan,但这对于这个项目来说似乎确实是大材小用。我的内存中将有一个 XML 文件,有一个样式表可以运行它......仅此而已。
输入 XML 和样式表都是内部的,并在到达我的代码之前对其完整性进行了验证,因此我实际上只想要最简单的方法来执行此类转换。我查看了libxslt,但它是基于C 的。主页将我引向 xmlwrapp,我开始使用它,却发现该项目已经有一段时间不受支持了。
您认为 xmlwrapp 是满足我的需求的不错选择吗?或者您会推荐一个不同的库吗?
I started off with Xalan for C++, but that really seemed like overkill for this project. I will have an XML file in memory, there is one stylesheet to run it through... and that's pretty much it.
The input XML and the stylesheet are all in-house and validated for integrity before it gets to my code so I really just wanted the simplest way to do this sort of transformation. I looked at libxslt, but it's C-based. The home page referred me to xmlwrapp which I started working with only to find out that this project hasn't been supported for a while.
Do you think xmlwrapp is a good choice for my needs, or would you recommend a different library?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
C 库可以很好地集成 C++ 代码。唯一的问题是,如果库本身被编译为 C,它将不会有 C++ 样式名称修改。通过确保所有标头都具有
extern "C" { ... }
包装器,可以轻松解决此问题。大多数 C 库已经将其与 #ifdef __cplusplus 预处理器语句一起使用,从而允许与 C++ 完全互操作。记住这一点,您应该能够直接使用libxslt
C libraries integrate well will C++ code. The only issue is if the library itself is compiled as C it will not have C++ style name mangling. This can easily be worked around by ensuring that all the headers have the
extern "C" { ... }
wrappers. Most C libraries will already have this together with the#ifdef __cplusplus
preprocessor statement which allows total interoperability with C++. Bearing this in mind you should be able to uselibxslt
directly