Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Files can be validated against specific schemas thanks to the XML Schema CheckValidation 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. So, this rule has to be copied and configured as many times as you have pairs of files/schema.

...

Property

...

Description

...

filePattern

schemas

...

.

Examples:

  • If empty, all the files will be validated.
  • pom*.xml will validate any of the following files: pom.xml, pom-module.xml
  • **/pom.xml will validate any of the following files: pom.xml, dir1/pom.xml, dir1/dir2/pom.xml

...

schemas

...

Whitespace-separated list of schemas 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.

Built-in schemas:

Namespace or Short name

Doctype

Description

http://www.w3.org/2001/xml.xsd

 

XML

http://www.w3.org/XML/1998/namespace XML

http://www.w3.org/1999/xhtml

 

XHTML1.0 Strict

xhtml1-strict

-//W3C//DTD XHTML 1.0 Strict//EN

XHTML1.0 Strict

xhtml1-transitional

-//W3C//DTD XHTML 1.0 Transitional//EN

XHTML1.0 Transitional

xhtml1-frameset

-//W3C//DTD XHTML 1.0 Frameset//EN

XHTML1.0 Frameset

 

-//W3C//DTD XHTML 1.1 Strict//EN

XHTML1.1

http://java.sun.com/jsf/core

 

JSF Core

http://java.sun.com/jsf/html

 

JSF HTML Basic

http://java.sun.com/jsf/facelets

 

JSF Facelets

http://maven.apache.org/POM/4.0.0

 

Maven Project Model

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

Custom Checks Using XPath Expressions

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

Property

Description

 

This rule allows to define some homemade XML rules with help of an XPath expression.

Violations are created depending on the return value of the XPath expression. If the XPath expression returns:

  • a single or list of AST nodes, then a line violation with the given message is created for each node
  • a boolean, then a file violation with the given message is created only if the boolean is true
  • anything else, no violation is created

Here is an example of an XPath expression to log a violation on each 'td' tag using the 'nowrap' deprecated attribute: //td[@nowrap]

filePattern

Files to be checked against the XPath expression set through the expression parameter.

Examples:

  • If empty, all the files will be checked.
  • pom*.xml will check any of the following files: pom.xml, pom-module.xml
  • **/pom.xml will check any of the following files: pom.xml, dir1/pom.xml, dir1/dir2/pom.xml
expressionThe XPath query.
messageThe violation message.

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

...