Description / Features
This plugin enables analysis of XML files within Sonar.
Some common use cases are:
- Validation of XHTML files against schemas provided by the W3C (strict, transitional, and others)
- Validation of XML files against a provided XML schema
- Validation of rules in XML files (ex: validate the Maven pom files against coding standards)
- Install the XML plugin through the Update Center or download it into the SONAR_HOME/extensions/plugins directory
- Restart the Sonar server
Run a Sonar Analysis with the Sonar Runner (Recommended Way)
To launch a Sonar analysis of your XML project, use the Sonar Runner.
Run a Sonar Analysis with the other Analyzers
Validating Files Against Specific Schema
Files can be validated against a specific schema thanks to the XML Schema Check rule.
Within the same project some files can be validated against schema 'S1', others against schema 'S2' and so on. So, this rule has to be copied and configured as many times as you have pairs of files/schema.
Files to be validated against the schema set through the schemas parameter.
Namespace of schema to use for validation.
It can either be set to:
Default value: autodetect. In this case, the parser will try to load the schema based on the doctype or the namespace declaration in the document.
- Schema validation is performed by the Xerces parser using XML schemas (XSDs).
- For validation of XHTML files it is recommended to use autodetect, xhtml1-transitional or xhtml1-strict.
Custom Checks Using XPath Expressions
The XPath Check allows to define custom checks on XML documents using XPath expressions.
Within the same project some files can be checked against XPath rules 'R1', 'R2', etc., others against rules 'R6', 'R7', etc. and so on. So, this rule has to be copied and configured as many times as you have pairs of files/rule.
Files to be checked against the XPath expression set through the xpathQuery parameter.
|xpathQuery||The XPath query|
|message||The violation message|
Release 1.0 (not yet released) (15 issues)
Release 0.2 (9 issues)