Does anyone knows maven plugin that validate xml documents against DTD or Schema and generates reports?
+2
A:
There is a maven-xml-plugin that can check whether XML files are matching an XML schema but I don't think it can generate reports.
Pascal Thivent
2009-10-06 20:15:16
+1
A:
The validate goal of the xml-maven-plugin will check for well-formedness and optionally validate against a schema. The build will fail if the validation fails.
The plugin does not produce any report, what would you want in a report out of interest? information about the invalid files?
Here is an example usage:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>validate</goal>
</goals>
</execution>
</executions>
<configuration>
<validationSets>
<validationSet>
<dir>src/main/xsd</dir>
<systemId>src/main/xmlschema.xml</systemId>
</validationSet>
</validationSets>
</configuration>
</plugin>
Rich Seller
2009-10-06 20:23:13
Yes, validatation error reports will help point out posible errors in xml files like PMD or Findbug does for java code. I've noticed that many developers skip xml or jsp validation errors/warnings while working with project, what may cause potential runtime errors.
cetnar
2009-10-06 21:06:53