使用 schematron 验证大型 xml 文件
我正在使用 schematron 来验证大型 xml 文件(几兆字节)。如果文件没问题(如果没有错误),验证速度相当快。但是,当错误计数增加时,模式验证时间的执行时间就会增加。
例如,当发现 200 个错误时,是否有任何方法可以停止 schematron XSLT 验证。这会有所帮助,因为如果存在包含数百次相同错误的大文件,那么仅报告第一个错误并要求用户在更正这些错误后再次验证文件就足够了。
I'm using schematron for validating large xml files (several megabytes). Validation is quite fast if files are ok (if there is no errors). But when the error count increases so increases the execution time of the schematron validation time.
Is there any way to stop the schematron XSLT-validation when for example 200 errors are found. That would help because if there are big files which contain hundreds of occurrences of the same error it would certainly be enough to report only first errors and ask the user to validate file again after correcting those.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过将 Schematron Terminator Validator 与 Schematron 阶段
终止符验证器允许 schematron 验证在遇到第一个错误时失败。
阶段允许将验证分为多个阶段并逐步进行。
这些之一或两者的组合应该让您接近您想要的 - 也许将所有规则类放入阶段,然后使用终止符运行每个阶段将给出良好的结果,允许用户立即得知多个错误。
You should be able to get very close to your requirement by combining the Schematron Terminator Validator with Schematron Phases
The terminator validator allows for a schematron validation to fail when the first error is hit.
Phases allow for validation to be broken up into stages and carried out progressively.
One or both of these in combination should get you close to what you want - perhaps putting all your rule classes into phases then running each phases with the terminator would give a good result, allowing users to be informated of several errors at once.