如何在Java中针对Schematron模式验证文档? [英] How can I validate documents against Schematron schemas in Java?

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

问题描述

据我所知,默认情况下,JAXP支持来自Java 6的W3C XML Schema和RelaxNG

我可以在 schematron.com链接页面

是否有在Java中验证schematron的方法是否完整,高效且可以与JAXP API一起使用?

Is there an approach on validating schematron in Java that's complete, efficient and can be used with the JAXP API?

推荐答案

Jing 支持ISO Schematron前验证(请注意,Jing的实现也基于XSLT)。

Jing supports pre-ISO Schematron validation (note that Jing's implementation is based also on XSLT).

还可以从Java轻松调用XSLT实现。您需要确定您感兴趣的Schematron版本,然后获取相应的样式表 - 所有这些都应该来自schematron.com。这个过程非常简单,基本上包含两个步骤:

There are also XSLT implementations that can be very easily invoked from Java. You need to decide what version of Schematron you are interested in and then get the corresponding stylesheet - all of them should be available from schematron.com. The process is very simple simple, involving basically 2 steps:


  • 在Schematron模式上应用骨架XSLT以获取代表的新XSLT样式表您在XSLT中的Schematron架构

  • 将获得的XSLT应用于您的实例文档或文档以验证它们

JAXP只是一个API,它不需要从实现中支持Relax NG。您需要检查用于查看是否支持Relax NG的具体实现。

JAXP is just an API and it does not require support for Relax NG from an implementation. You need to check the specific implementation that you use to see if that supports Relax NG or not.

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

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