Validating Co-Constraints

Roger Costello

Click arrow key () to navigate to next page

Example: Checking Classifications

  1. <?xml version="1.0"?>
  2. <Document classification="secret">
  3. <Para classification="unclassified">
  4. One if by land, two if by sea;
  5. </Para>
  6. </Document>

Classification Values

Rule #1

  1. <sch:rule context="Para[@classification='top-secret']">
  2. <sch:assert test="/Document/@classification='top-secret'">
  3. If there is a Para labeled "top-secret" then the Document
  4. must be labeled top-secret
  5. </sch:assert>
  6. </sch:rule>

Rule #2

  1. <sch:rule context="Para[@classification='secret']">
  2. <sch:assert test="(/Document/@classification='top-secret') or
  3. (/Document/@classification='secret')">
  4. If there is a Para labeled "secret" then the Document
  5. must be labeled either secret or top-secret
  6. </sch:assert>
  7. </sch:rule>

Rule #3

  1. <sch:rule context="Para[@classification='confidential']">
  2. <sch:assert test="(/Document/@classification='top-secret') or
  3. (/Document/@classification='secret') or
  4. (/Document/@classification='confidential')">
  5. If there is a Para labeled "confidential" then the Document
  6. must be labeled either confidential, secret or top-secret
  7. </sch:assert>
  8. </sch:rule>

Pattern

  1. <sch:pattern name="Security Classification Policy">
  2. <sch:p>A Para's classification value cannot be more sensitive
  3. than the Document's classification value.</sch:p>
  4. <sch:rule context="Para[@classification='top-secret']">...</sch:rule>
  5. <sch:rule context="Para[@classification='secret']">...</sch:rule>
  6. <sch:rule context="Para[@classification='confidential']">...</sch:rule>
  7. </sch:pattern>

Schematron Schema

  1. <?xml version="1.0"?>
  2. <sch:schema xmlns:sch="http://www.ascc.net/xml/schematron">
  3. <sch:pattern name="Security Classification Policy">
  4. <sch:p>A Para's classification value cannot be more sensitive
  5. than the Document's classification value.</sch:p>
  6. <sch:rule context="Para[@classification='top-secret']">...</sch:rule>
  7. <sch:rule context="Para[@classification='secret']">...</sch:rule>
  8. <sch:rule context="Para[@classification='confidential']">...</sch:rule>
  9. </sch:pattern>
  10. </sch:schema>

Validation

  1. <?xml version="1.0"?>
  2. <Document classification="secret">
  3. <Para classification="unclassified">...</Para>
  4. <Para classification="confidential">...</Para>
  5. <Para classification="unclassified">...</Para>
  6. <Para classification="secret">...</Para>
  7. </sch:schema>

Use Oxygen XML

  1. <?xml version="1.0"?>
  2. <?oxygen SCHSchema="check-classifications.sch" type="xml"?>
  3. <Document classification="secret">
  4. <Para classification="unclassified">...</Para>
  5. <Para classification="confidential">...</Para>
  6. <Para classification="unclassified">...</Para>
  7. <Para classification="secret">...</Para>
  8. </Document>

Use Oxygen XML (cont.)

Use Oxygen XML (cont.)

Clicking on the red checkmark in the toolbar results in Oxygen XML validating the instance document against the Schematron schema.

Example Invalid Instance

Oxygen PI Not Necessary

Use Topologi

Use Topologi (cont.)

Selecting the instance document on the left, the Schematron document on the right, and then clicking the Run button results in Topologi validating the instance document against the Schematron schema.

Lab 1

Lab 1

Homepage