Interpreting XML Data

A draft may be viewed and constructed through the rule builder. Alternatively, a draft or a policy may be viewed in its raw XML format.

Leverage a code comparison tool (e.g., Code Compare) and the raw XML view to quickly discover the changes between different versions of a policy. This may be accomplished by simply copying both versions of the XML to the code comparison tool and then running a comparison.

Sample XML code is provided below.

<policy>

<rules>

<rule>

<description>Default Internal and External Max-Age</description>

<match.always>

<feature.caching.force-internal-max-age status="200" value="6" units="hours" />

<feature.caching.external-max-age status="200" value="6" units="hours" />

</match.always>

</rule>

<rule>

<description>Default Internal and External Max-Age for HTML and HTM Assets</description>

<match.url.url-path-extension.wildcard result="match" value="html htm" ignore-case="true">

<feature.caching.force-internal-max-age status="200" value="5" units="minutes" />

<feature.caching.external-max-age status="200" value="5" units="minutes" />

</match.url.url-path-extension.wildcard>

</rule>

<rule>

<description>Deny Access to Unauthorized Requests for Private Information</description>

<match.url.url-path.wildcard result="match" value="/800001/myorigin/private/*" ignore-case="true" relative-to="root">

<match.request.referring-domain.wildcard result="nomatch" value="secure.example.com" ignore-case="true">

<feature.access.deny-access enabled="true" />

</match.request.referring-domain.wildcard>

</match.url.url-path.wildcard>

</rule>

</rules>

</policy>

Each XML tag is described below.

XML tags will always comply with the hierarchy defined below.

XML Tag Description

policy

This tag encloses all other tags defined in a policy or a draft.

rules

This tag encloses all rules.

rule

This tag contains all of the tags associated with an individual rule.

A start and end <rule> tag is generated for each rule in a draft/policy.

description

Enclosed within this tag is an optional description for the current rule.

match.CategoryIdentifies the match condition's category..NameIdentifies a match condition by its name. result='ComparisonIndicates whether the match condition is satisfied when a request matches or does not match the specfied criterion.' value='ValueIndicates the comparison value assigned to the match condition.' Setting(s)Some match conditions require additional configuration. One or more settings may be defined within the match condition's XML tag.

This tag identifies a match condition. The parameters defined for this match condition define its configuration.

The tag for the Always match condition does not following this naming convention. It is simply <match.always>.

This tag may enclose:

  • Match Conditions: A nested match condition identifies an AND IF relationship between two match conditions. Both match conditions must be met before the feature associated with the second match condition may be applied to a request.
  • Features: Identifies an action (i.e., feature) that will be applied to a request when it satisfies a parent match condition.

A start and end <match> tag is generated for each match condition in a rule.

feature.CategoryIdentifies the feature's category..NameIdentifies a feature by its name. Setting(s)All features require 1 or more settings to be defined. These settings are defined within the feature's XML tag.

This tag identifies a feature that will be applied to a request when it satisfies the parent match condition.

This tag cannot contain another element. As a result, the closing tag is always specified (e.g., <feature.caching.bypass-cache enabled='true'/>).

select.first-match

This tag identifies the start and end of a select first match section. This type of tag may enclose match conditions.

Features may be nested under a match condition defined in a select first match section.

The match conditions defined in this type of section behave differently from those defined outside of it.

Differences:

  • Match conditions at the same level are treated as ELSE IF instead of OR conditions.
  • No additional processing will be performed within a select first match section once a request satisfies a match condition.