command line validator supporting relax ng Schemas with embedded iso Schematron

青春壹個敷衍的年華 提交于 2019-12-31 03:08:08

问题


Are there any command line-validators that can cope with relax ng-Schemas with embedded iso schematron?

I've got a couple of relax ng-schemas with embedded iso-schematron rules which I have to be able to validate on the command line. As it seems, jing, our usual validator, only works with schematron 1.5. Surfing the web, I haven't been able to find any validator supporting embedded iso schematron but I use oXygen as an xml editor and I can validate just fine from there.


回答1:


You can use Jing, as long as you first extract the Schematron rules, and then run a separate validation against the extracted Schematron schema. Schematron extraction is possible with the RNG2Schtrn.xsl XSLT style sheet (it's a bit hard to find online, but we have a copy at https://github.com/citation-style-language/utilities/blob/master/RNG2Schtrn.xsl) and Saxon (which is bundled along with Jing). If your schema is in the compact .rnc syntax, you first have to convert it to the XML .rng syntax, for which you can use Trang.

And excerpt from 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

See also https://stackoverflow.com/a/18616036/1712389



来源:https://stackoverflow.com/questions/23906793/command-line-validator-supporting-relax-ng-schemas-with-embedded-iso-schematron

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!