libxml2 - 根据模式验证 XML 文档。从实际 XML 文件中检索架构 url

发布于 2024-08-18 17:22:32 字数 116 浏览 1 评论 0原文

我需要根据 DTD 架构验证 xml 文件。我发现我需要传递架构文件的源进行验证。是否可以使 libxml2 在 XML 文件中找到架构声明并自行进行验证,或者我是否必须手动检索声明?

提前致谢 米哈尔

I need to validate a xml file against DTD schema. I found out that I need to pass the source of schema file for validation. Is that possible to make libxml2 find the declaration of schema in XML file and do the validation on its own, or do I have to retrieve the declaration manually?

Thanks in advance
Michal

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜中书 2024-08-25 17:22:32

理论上,您可以在 XML 文件中放置一个 xsi:schemaLocation 属性,让 XML 处理器找出 XML 架构的位置。

libXML 中 xsi:schemaLocation 的状态不清楚,请参阅此错误报告:https://bugzilla.gnome.org/show_bug.cgi?id=157205。它似乎在库本身中实现,但在提供的 xmllint util 中未启用。

In theory you could use put an xsi:schemaLocation attribute in the XML file and let the XML processors find out where the XML Schema is.

The status of xsi:schemaLocation in libXML is unclear, see this bug report: https://bugzilla.gnome.org/show_bug.cgi?id=157205. It seems implemented in the library itself but not enabled in the provided xmllint util.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文