Databases Reference
In-Depth Information
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
If the card type is American Express, then the security code should be four
digits in length, otherwise it should be three digits
The expiry date, which consists of the expiryMonth and expiryYear
elements, should be in the future
For each assertion, we can also specify meaningful diagnostic messages, which
indicate why an assertion hasn't been met (as opposed to schema validation
messages, which aren't always so enlightening).
The other advantage of using Schematron is that it enables us to modify the
assertions for a document without the need to change the schema.
However, rather than considering Schematron as an alternative approach to XML
Schema validation, we see it very much as complementary. Thus, we would use
XML Schema to validate the core structure of the XML, but not make those checks
too granular. Rather, we will place those checks along with ones that can't be
expressed in XML Schema in Schematron.
Overview of Schematron
One of the advantages of Schematron is that being based on XSLT makes it extremely
easy to learn. Effectively, it has several key constructs. Once these are understood,
you are ready to unleash the full power of the tool.
So before we look at how to use Schematron within the SOA Suite, we will give a
quick introduction to Schematron itself. Readers who are familiar with Schematron
may still want to skim this section, just to understand some of the idiosyncrasies of
how Schematron behaves within the Oracle SOA Suite.
If we look at the operation updateCreditCard , which forms part of the
userManagement service, a typical XML instance for this operation would appear as
shown in the following code snippet:
<soap:Envelopexmlns:soap="http://schemas.xmlsoap.org/soap/envelope">
<soap:Bodyxmlns:ebm="http://rubiconred.com/obay/ebm/UserAccount"
xmlns:usr="http://rubiconred.com/obay/xsd/user"
xmlns:cmn="http://rubiconred.com/obay/xsd/common">
<ebm:updateCreditCard>
<usr:userId>jsmith</usr:userId>
 
Search WWH ::




Custom Search