PNML documents validation

There are many tools to validate XML files against their RELAX NG grammar. In the case of PNML, here is a summary of the means you can use.

PNML Framework's ecosystem

We are providing PNML Document Checker (PNML DoC), a simple application to validate PNML Documents against the standard specification. PNML DoC relies on PNML Framework to do so. We recommend using this application to validate your PNML documents. If you feel that it is missing some important feature, please let us know.

XML Lint

xmllint is part of the very useful Libxml2 toolkit for XML processing. It supports RELAX NG, so you can also use it to check PNML Documents via this Shell script we provide.

The check is performed against PNML grammar only. Validation against PNML Schematron rules (see below) is not enabled since the support of Schematron by xmllint seems, for the moment, not compatible with these.

This script assumes that you have xmllint and perl installed, and an Internet connectivity (it fetches the grammar from this site). So please, make sure these three requirements are met.

Validation wrapped in a Apple's Automator Service

If you are a Mac user, then you can use the same script we have turned into a Service, via the contextual menu on your PNML Documents.

Just download, uncompress and install this workflow into your $HOME/Library/Services/ folder. Then you can start using it right away on your PNML Documents in Finder!

Right-click on your PNML Documents (one or several) in Finder, then select the service Validate PNML Document(s). After a while, the validation report should be opened in Safari.

The same three requirements as stated above apply for the correct operation of this service.

Further validation with Schematron

You may also want to use the Schematron rules we have provided to validate Core models, P/T nets and Symmetric nets PNML Documents. The Schematron rules specify most of the OCL constraints found in the metamodels of the PNML standard.

Jing

PNML Framework uses Jing, a RELAX NG validator by James Clark, to validate a PNML Document against its grammar. Jing can be used either as a library or as a command-line tool. So, it is a pretty useful tool you may add to your PNML toolkit.

You are advised to turn ID validation off on PNML files, if you are directly using Jing. This issue is related to our anyElement definition, and xsd:ID - xsd:IDREF compatibility issues with RELAX NG. We use the anyElement construct for ToolSpecific definition, to allow any well-formed XML to be included. The following blog article discusses this issue.

With ID validation turned on with Jing, you may get an error about conflicting ID types. So just turn it off, or have a specific program check ID uniqueness and IDREFs coherence for you. Using PNML DoC, you should not have to bother about this, since we take care of that.