简体   繁体   English

应用XSLT转换后自动测试许多XML文件

[英]Automatically test many XML files after applying XSLT transformation

We have a application which converts RDF file to desired XML file using XSLT transformation. 我们有一个使用XSLT转换将RDF文件转换为所需XML文件的应用程序。 Using above application we generate more than 1000 files. 使用上述应用程序,我们生成了1000多个文件。 So I wanted to know whether is there any way in which we could automatically test all the new changes which we apply using XSLT? 因此,我想知道是否有什么方法可以自动测试使用XSLT应用的所有新更改?

Currently we are manually opening the XML files and checking if those changes are reflected on all the files. 当前,我们正在手动打开XML文件,并检查这些更改是否反映在所有文件上。

So can anyone please suggest a optimal way to test the generated XML files automatically 所以任何人都可以建议一种自动测试生成的XML文件的最佳方法

  • You can validate your XML files against an XSD as a next step after the XSLT transformation. 在XSLT转换之后,下一步可以针对XSD验证XML文件。
  • Some XSLT 2.0/3.0 processors are schema-aware, and support validation against an XSD as a part of XSLT transformation. 某些XSLT 2.0 / 3.0处理器支持模式识别,并且作为XSLT转换的一部分,支持针对XSD进行验证。

Useful link: XML validation on XSD during XSLT transformation 有用的链接: XSLT转换期间在XSD上进行XML验证

Well, you obviously need to define some rules that you are testing the generated files against. 好了,您显然需要定义一些规则,以这些规则测试生成的文件。 From your description it's not clear what these rules are, or where they might come from. 从您的描述中,尚不清楚这些规则是什么或它们可能来自何处。 So there are two parts to your task: defining the rules that the generated documents have to obey, and then actually running these rules against the output. 因此,您的任务分为两部分:定义生成的文档必须遵守的规则,然后针对输出实际运行这些规则。

Depending on the nature of the rules, there are a number of technologies you could deploy: you could implement the rules in Schematron, in XSD (especially 1.1), in XSLT, or in XUnit. 根据规则的性质,可以部署多种技术:您可以在Schematron,XSD(尤其是1.1),XSLT或XUnit中实现规则。 And then of course you'll need some kind of script to actually run the rules. 然后,当然,您需要某种脚本来实际运行规则。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM