【问题标题】:command line validator supporting relax ng Schemas with embedded iso Schematron支持带有嵌入式iso Schematron的relax ng Schema的命令行验证器
【发布时间】:2014-05-28 08:45:53
【问题描述】:

是否有任何命令行验证器可以处理带有嵌入式 iso schematron 的松弛 ng-Schemas?

我有几个带有嵌入式 iso-schematron 规则的松弛 ng-schemas,我必须能够在命令行上对其进行验证。看起来,我们常用的验证器 jing 只适用于 schematron 1.5。在网上冲浪时,我找不到任何支持嵌入式 iso schematron 的验证器,但我使用 oXygen 作为 xml 编辑器,我可以从那里很好地验证。

【问题讨论】:

    标签: validation relaxng schematron


    【解决方案1】:

    您可以使用 Jing,只要您首先提取 Schematron 规则,然后针对提取的 Schematron 模式运行单独的验证。 Schematron 提取可以使用 RNG2Schtrn.xsl XSLT 样式表(在网上有点难找,但我们在https://github.com/citation-style-language/utilities/blob/master/RNG2Schtrn.xsl 有一份副本)和 Saxon(与 Jing 捆绑在一起)。如果您的架构采用紧凑的 .rnc 语法,您首先必须将其转换为 XML .rng 语法,您可以使用 Trang。

    摘自https://github.com/citation-style-language/utilities/blob/master/style-qc.sh

    # Jing currently ignores embedded Schematron rules.
    # For this reason, the schema is first converted to
    # RELAX NG XML, after which the Schematron code is
    # extracted and tested separately.
    java -jar ${pathTrang} ${pathCSLSchema} ${TMP_DIR}/csl.rng
    java -jar ${pathSaxon} -o ${TMP_DIR}/csl.sch ${TMP_DIR}/csl.rng RNG2Schtrn.xsl
    java -jar ${pathJing} ${TMP_DIR}/csl.sch ${pathCSLStyles}/*.csl || true
    
    # RELAX NG Compact validation
    java -jar ${pathJing} -c ${pathCSLSchema} ${pathCSLStyles}/*.csl || true
    

    另见https://stackoverflow.com/a/18616036/1712389

    【讨论】:

    • 谢谢,我怀疑我必须做这样的事情。我已经阅读了其他带有嵌入式 schematron 的模式语言的类似内容。
    猜你喜欢
    • 2012-11-30
    • 2011-09-13
    • 1970-01-01
    • 1970-01-01
    • 2012-10-29
    • 1970-01-01
    • 1970-01-01
    • 2012-07-11
    • 1970-01-01
    相关资源
    最近更新 更多