Description / Features
This plugin enables analysis of XML files within Sonar.
Some common use cases are:
- Validation of XHTML files by using the XHTML schemas as provided by the W3C (strict, transitional, and others). Quickly validate the markup of a set of XHTML files.
- Validation of XML files for conformance to the provided XML schema.
- Validation of rules in XML files (ex: validate the Maven pom files for conformance to 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
The following properties of the plugin are configurable:
Additional filter for the files to be scanned
An XmlSchemaCheck rule is available and can be copied and instantiated multiple times. It has two parameters:
Filter for the files to be validated with this check.
Namespace of schema to use for validation.
If you set the 'schemas' parameter to 'autodetect', 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). The plugin has a couple of schemas available:
Namespace or Short name
-//W3C//DTD XHTML 1.0 Strict//EN
-//W3C//DTD XHTML 1.0 Transitional//EN
-//W3C//DTD XHTML 1.0 Frameset//EN
-//W3C//DTD XHTML 1.1 Strict//EN
JSF HTML Basic
Maven Project Model
- For validation of XHTML files it is recommended to use autodetect, xhtml1-transitional or xhtml1-strict.
- There is no XML schema for HTML 5 provided by W3C.
- If you need to check with another schema, you can provide the path or URL to the schema. The plugin will search for the schema by URL then fallback on filesystem using a relative path.
The XPath Check allows to specify checks on XML documents using XPath expressions.
The purpose of the check is to look for nodes and attributes that are not allowed.
The rule has two parameters:
- expression for the XPath expression
- filePattern to specify files to be included (e.g. */myfiles/.xml)
Find all occurrences of <b>
Find all occurrences of td with the deprecated attribute nowrap
Release 1.0 (not yet released) (15 issues)
Release 0.2 (9 issues)