Preprocessing Model for Markup Consumption

Markup consumers might rely on a preprocessing model to support Markup Compatibility. Such a model can simplify the markup consumer’s implementation and allow it to rely on XML schema validation for the preprocessed markup document. Furthermore, a single preprocessing implementation can be shared by markup consumers that target various markup specifications.

A markup preprocessor accepts as input XML markup containing a variety of elements and attributes from the following namespace categories:

  • The Markup Compatibility namespace.

  • Current namespaces: Understood namespaces that have not been subsumed by newer namespaces.

  • Obsolete namespaces: Understood namespaces known to have been subsumed by newer namespaces).

  • Non-understood namespaces.

The markup preprocessor transforms its input markup into output markup that contains elements and attributes drawn only from current and non-understood namespaces. This transformation is disabled for input markup nested within an application-defined extension element. The markup preprocessor accomplishes its transformation using the following rules:

The markup preprocessor checks for the correct usage of all elements and attributes in the Markup Compatibility namespace, and triggers error processing if an element or attribute in that namespace violates the requirements of this Markup Compatibility Part.

The markup preprocessor interprets occurrences of the @MustUnderstand attribute, and triggers error processing when appropriate.

The markup preprocessor removes all elements and attributes in the Markup Compatibility namespace, removing the contents of unselected <Choice> and Fallback elements.

The markup preprocessor removes all elements and attributes in obsolete namespaces, and replaces them with identically named elements and attributes in current namespaces.

Guided by the @Ignorable attribute, the markup preprocessor removes some elements and attributes in non-understood namespaces, leaving others undisturbed.

Guided by the @ProcessContent attribute, the markup preprocessor removes all nested content within some removed elements from non-understood namespaces.

In addition to producing such transformed output, the markup preprocessor might also implement mechanisms to optionally provide to a markup editor the additional information necessary to preserve some ignored content.

Note:

If a markup preprocessor is used in conjunction with XSD schema validation, the schema should set the value of the @elementFormDefault attribute of the root <schema> element to the value qualified. ]

Given the following input document:

<Circles
  xmlns="http://schemas.openxmlformats.org/Circles/v1"
  xmlns:mc="http://schemas.openxmlformats.org/markup-
  compatibility/2006" 
  xmlns:v2="http://schemas.openxmlformats.org/Circles/v2" 
  xmlns:v3="http://schemas.openxmlformats.org/Circles/v3" 
  mc:Ignorable="v3"
  mc:ProcessContent="v3:Blink">
  <mc:AlternateContent>
    <mc:Choice Requires="v3">
      <v3:Circle Center="0,0" Radius="20" Color="Blue" 
        Opacity="0.5" Luminance="13" />
      <v3:Circle Center="25,0" Radius="20" Color="Black" 
        Opacity="0.5" Luminance="13" />
      <v3:Circle Center="50,0" Radius="20" Color="Red"
        Opacity="0.5" Luminance="13" />
      <v3:Circle Center="13,0" Radius="20" Color="Yellow" 
        Opacity="0.5" Luminance="13" />
      <v3:Circle Center="38,0" Radius="20" Color="Green" 
        Opacity="0.5" Luminance="13" />
    </mc:Choice>
    <mc:Fallback>
      <LuminanceFilter Luminance="13">
        <Circle Center="0,0" Radius="20" Color="Blue" 
          v2:Opacity="0.5" />
        <Circle Center="25,0" Radius="20" Color="Black" 
          v2:Opacity="0.5" />
        <Circle Center="50,0" Radius="20" Color="Red" 
          v2:Opacity="0.5" />
        <Circle Center="13,0" Radius="20" Color="Yellow" 
          v2:Opacity="0.5" />
        <Circle Center="38,0" Radius="20" Color="Green" 
          v2:Opacity="0.5" />
      </LuminanceFilter>
    </mc:Fallback>
  </mc:AlternateContent>
  <v3:Blink>
    <Circle Center="13,0" Radius="20" Color="Yellow" />
    <Circle Center="38,0" Radius="20" Color="Green" />
  </v3:Blink>
  <v3:Watermark>
    <Circle Center="50,0" Radius="20" Color="Red" />
  </v3:Watermark>
</Circles>

According to §10.2, this markup document’s markup specification, when it defines the namespace name http://schemas.openxmlformats.org/Circles/v2, shall state the intended subsumption behavior when processing a Version 2 @Opacity attribute that is applied to a <Circle> element from an earlier version. Depending on that statement, a Version 2 markup consumer renders the above markup as if it had processed one of the following pieces of preprocessed markup:

<v2:Circles
  v2:xmlns="http://schemas.openxmlformats.org/Circles/v2">
  <v2:LuminanceFilter Luminance="13">
    <v2:Circle Center="0,0" Radius="20" Color="Blue" 
      Opacity="0.5" />
    <v2:Circle Center="25,0" Radius="20" Color="Black" 
      Opacity="0.5" />
    <v2:Circle Center="50,0" Radius="20" Color="Red" 
      Opacity="0.5" />
    <v2:Circle Center="13,0" Radius="20" Color="Yellow" 
      Opacity="0.5" />
    <v2:Circle Center="38,0" Radius="20" Color="Green" 
      Opacity="0.5" />
  </v2:LuminanceFilter>
  <v2:Circle Center="13,0" Radius="20" Color="Yellow" />
  <v2:Circle Center="38,0" Radius="20" Color="Green" />
</v2:Circles>

Or:

<v2:Circles
  v2:xmlns="http://schemas.openxmlformats.org/Circles/v2">
  <v2:LuminanceFilter Luminance="13">
    <v2:Circle Center="0,0" Radius="20" Color="Blue" 
      v2:Opacity="0.5" />
    <v2:Circle Center="25,0" Radius="20" Color="Black" 
      v2:Opacity="0.5" />
    <v2:Circle Center="50,0" Radius="20" Color="Red" 
      v2:Opacity="0.5" />
    <v2:Circle Center="13,0" Radius="20" Color="Yellow" 
      v2:Opacity="0.5" />
    <v2:Circle Center="38,0" Radius="20" Color="Green" 
      v2:Opacity="0.5" />
  </v2:LuminanceFilter>
  <v2:Circle Center="13,0" Radius="20" Color="Yellow" />
  <v2:Circle Center="38,0" Radius="20" Color="Green" />
</v2:Circles>