Validation Against Requirements of this Part

A markup document may satisfy requirements of this Annex without being an Office Open XML document. The following NVDL script examines whether a given document correctly uses the attributes and elements as defined by this Part.

This NVDL script first extracts elements and attributes in the Markup Compatibility namespace, and then validates them against the appropriate RELAX NG schemas.

Note that <AlternateContent>, <Choice> and <Fallback> elements are allowed to have foreign elements and attributes.

<?xml version="1.0" encoding="UTF-8"?>
<rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0">
  <namespace match="attributes" ns="http://schemas.openxmlformats.org/markup-
    compatibility/2006">
    <validate schemaType="application/relax-ng-compact-syntax">
      <schema>
        namespace mc="http://schemas.openxmlformats.org/markup-
         compatibility/2006"
        nsList = list { xsd:NCName* }
        qnameList = list { (xsd:QName | xsd:string {pattern = "\i\c*:\*" })*}
        start = element * {
          attribute mc:Ignorable { nsList }?,
          attribute mc:ProcessContent { qnameList }?,
          attribute mc:PreserveElements { qnameList }?,
          attribute mc:PreserveAttributes { qnameList }?,
          attribute mc:MustUnderstand { nsList }?
        }
      </schema>
    </validate>
  </namespace>
  <namespace match="elements" ns="http://schemas.openxmlformats.org/markup-
  compatibility/2006">
    <validate schemaType="application/relax-ng-compact-syntax">
      <schema>
        default namespace ="http://schemas.openxmlformats.org/markup-
          compatibility/2006"
        nsList = list { xsd:NCName* }
        qnameList = list { (xsd:QName | xsd:string {pattern = "\i\c*:\*" })*}
        start = element AlternateContent {choice+,fallback?}
        choice = element Choice {attribute Requires { nsList }, text}
        fallback = element Fallback {text}
      </schema>
    </validate>
  </namespace>
  <namespace ns="" match="attributes">
    <attach/>
  </namespace>
  <anyNamespace match="elements attributes">
    <allow/>
  </anyNamespace>
</rules>

The two RELAX NG schemas embedded in the above NVDL script may be rewritten in the analogous XML Schema form.