如何针对libxml ++中的RelaxNG模式验证xml文档 [英] How to validate xml document against relaxNG schema in libxml++

查看:96
本文介绍了如何针对libxml ++中的RelaxNG模式验证xml文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于在C ++中解析xml和一般而言xml,我还是比较陌生. 我正在尝试使用来自libxml ++库的SAXParser解析我的文档,但是,我也希望它可以针对一个RelaxNG模式来验证我的文档.我发现libxml ++下面的libxml2有一个RelaxNG模块,但是我找不到如何使用其libxml ++绑定的方法.任何线索或代码片段将不胜感激.

I'm rather new to parsing xml in c++ and to xml in general. I'm trying to parse my document with SAXParser from libxml++ library, however, I would also like it to validate my document against a relaxNG schema. I've found that libxml2, which is underneath libxml++, has a relaxNG module, but I was unable to find out how to use its libxml++ binding. Any clues or code snippets would be appreciated.

推荐答案

在尝试了几次之后,我发现libxml ++中没有没有RelaxNG包装器,这就是为什么我无法在网上找到任何东西的原因.最终,我决定仅使用libxml2进行验证,然后使用来自libxml ++的SAXParser解析xml.

After several tries it occured to me, that there is no relaxNG wrapper in libxml++, that is why I was unable to find anything in the net. Finally I decided to do the thing using libxml2, just for validation purposes, and then parse xml using SAXParser from libxml++.

这篇关于如何针对libxml ++中的RelaxNG模式验证xml文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆