Using Schematron for validation

Schematron provides another means of validating the message payload of a web service. It takes a markedly different approach from Schema validation in that rather than checking the overall structure of the XML instance, it enables you to specify one or more assertions that we wish to enforce. If all these assertions are met, the document is deemed to be valid.

These assertions are specified using XPath, so it allows us to specify constraints that can't be expressed using XML Schema. For example, following on from the preceding example, we can define the following validations on a credit card.

  • If the card type is American Express, then the card number should be 15 digits in length, otherwise it should be 16 digits ...

Get Oracle SOA Suite 11g R1 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.