Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{iframe:src=http://update.sonarsource.org/plugins/xml-confluence.html|width=700|height=250300|frameborder=0}
Your browser does not support iframes.
{iframe}

...

This plugin enables analysis of XML files within SonarSonarQube.

It is compatible with the Issues Report plugin to run pre-commit local analysis.

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)

Installation

  1. Install the XML plugin through the Update Center or download it into the SONAR_HOME/extensions/plugins directory
  2. Restart the Sonar server

Usage

Run a Sonar Analysis with the Sonar Runner (Recommended Way)

...


Include Page
Include - Plugin Installation
Include - Plugin Installation

Usage

Run an Analysis with the SonarQube Runner (Recommended Method)

To run an analysis of your XML project, use the Sonar SonarQube Runner.

A sample project is available on github that can be browsed or downloaded/projects/languages/xml/xml-sonar-runner.

Run

...

an Analysis with the other Analyzers

Maven and Ant can also be used to launch analysis on XML projects.

...

Files can be validated against specific schemas thanks to the XML the XML Schema Validation ruleValidation rule.

Within the same project some files can be validated against schema 'S1', others against schema 'S2', others against schemas 'S3' and 'S4', and so on. SoTherefore, this rule has to must be copied and configured as many times as you have pairs of files/schemas.

Notes:

  • 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 xhtml1or xhtml1-strict.

Custom Checks Using XPath Expressions

The XPath rule allows you to define custom rules 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 Therefor, this rule has to be copied and configured as many times as you have pairs of files/rule.

Metrics

See Metrics documentation page.

Change Log

JIRA Issues
anonymoustrue
titleRelease 1.0 (not yet released)
renderModestatic
width900
columnstype;key;summary;priority
urlhttp://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?fixfor=18452&pid=11911&sorter/field=priority&sorter/order=DESC&tempMax=1000

 

JIRA Issues
anonymoustrue
titleRelease 0.2
renderModestatic
width900
columnstype;key;summary;priority
urlhttp://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?fixfor=17353&pid=11911&sorter/field=priority&sorter/order=DESC&tempMax=1000

 

JIRA Issues
anonymoustrue
titleRelease 0.1
renderModestatic
width900
columnstype;key;summary;priority
urlhttp://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?fixfor=17345&pid=11911&sorter/field=priority&sorter/order=DESC&tempMax=1000