1

I would like to validate my XML files against the XSD i have written during the project Build, and if the XML is not valid the build should not complete.

Is the possible? if so can you please point me in the right direction.

4

3 回答 3

3

找到了一个很好的解决方案(xml-maven-plugin)。这是一个 Maven 插件,可验证 xml 与架构等

于 2013-05-14T21:44:17.090 回答
0

如果您可以将脚本作为预构建事件运行,那么您可以调用验证代码来检查您的 XML 与您的 XSD。

我不在 NetBeans 中工作,但我通过 Google 搜索找到了这个菜单选项:

Project Properties -> Build -> Make -> Build Command

于 2013-05-14T21:05:55.193 回答
0

是的,绝对有可能,而且是个好主意。您所需要的只是一个验证 XML 解析器。这些可用于多种语言,包括 Java、.Net 等。

于 2013-05-14T21:06:54.417 回答