Process a Content Item

Retrieved content items are embedded in Atom entry resources as Viz Data Format (VDF) payload documents:

<vdf:payload xmlns:vdf="http://www.escenic.com/types" 
     model="http://host-ip-address/webservice/escenic/model/another">  
  <vdf:field name="BODY">
    <vdf:value> 
        <div xmlns="http://www.w3.org/1999/xhtml"> 
          <p>This is a test</p>
        </div> 
    </vdf:value>
  </vdf:field>  
</vdf:payload>

VDF is a proprietary format. Basically, content items are encoded as a sequence of vdf:field elements - one for each field in the content item. The exact structure of the VDF document therefore depends on the content type of the returned content item.

For simple cases where you know the structure of the content items to be retrieved, it may be sufficient for you to "hard-code" your client to deal with the expected content types. If, however, you want to make a generic client that can deal with any kind of content item, then you can do so by making use of the document's model.

The root element of a VDF payload document returned by the Content Engine always has a model attribute that contains a reference to a VDF model document. This document contains a schema defining the structure and content of the payload document. That is, it tells you what fields the payload document may contain, how they are organized and what data types they contain. Your client can therefore download this model document and use it as a guide to processing the contents of the payload document.

The field types defined in a Content Engine content-type resource correspond to VDF model field definitions as follows:

Escenic field definitions (in content-type resource)Corresponding VDF model fielddef
<field name="..." type="basic" mime-type="text/plain" .../>
<vdf:fielddef name="..." xsdtype="string" mediatype="text/plain"/>
<field name="..." type="basic" mime-type="application/xhtml+xml" .../>
<vdf:fielddef name="..." xsdtype="string" mediatype="application/xhtml+xml"/>
<field name="..." type="boolean" .../>
<vdf:fielddef name="..." xsdtype="boolean" mediatype="text/plain"/>
<field name="..." type="number" .../>
<vdf:fielddef name="..." xsdtype="decimal" mediatype="text/plain"/>
<field name="..." type="enumeration" multiple="false" .../>
<vdf:fielddef name="...">
  <vdf:choice>
    <vdf:alternative>...</vdf:alternative>  
    <vdf:alternative>...</vdf:alternative>
    ...
  </vdf:choice>  
</vdf:fielddef>
<field name="..." type="complex" ...>
  <complex>
    <field name="..." .../>
    <field name="..." .../>
    ...
  </complex>
</field>
<vdf:fielddef name="...">
  <vdf:fielddef name="..." .../>
  <vdf:fielddef name="..." .../>
  ...
</vdf:fielddef>
<field name="..." type="number" .../>
  <array/>
</field>
<vdf:fielddef name="...">
  <vdf:listdef>
    <vdf:schema>
      <vdf:fielddef name="..." xsdtype="decimal" mediatype="text/plain" />
    </vdf:schema>
  </vdf:listdef>
</vdf:fielddef>
<field name="..." type="schedule"/>

not described in VDF model - see below.

<field name="..." type="enumeration" multiple="false" .../>

not currently supported - see below.

<field name="..." type="link" .../>

not currently supported - see below.

Schedule fields

Schedule fields are not described in the VDF model although they are included in the returned VDF payload document. They are encoded in Escenic syndication format, using the syndication format's schedule elements. For a detailed description of the schedule element and it's content model, see the schedule:schedule.

The following example shows a content item Atom entry resource that contains a schedule field.

<entry xmlns="http://www.w3.org/2005/Atom"
       xmlns:app="http://www.w3.org/2007/app" 
       xmlns:metadata="http://xmlns.escenic.com/2010/atom-metadata" 
       xmlns:dcterms="http://purl.org/dc/terms/">  
  <id>http://host-ip-address/webservice/escenic/content/43</id>
  ...
  <content type="application/vnd.escenic.payload+xml"> 
    <vdf:payload xmlns:vdf="http://www.escenic.com/types" 
         model="http://host-ip-address/webservice/escenic/model/another">
      ...
      <vdf:field name="OPENING-HOURS">  
        <vdf:value>          
          <schedule xmlns="http://xmlns.escenic.com/2011/schedule" time-zone="Asia/Almaty">
            <recurrence>
              <daily start-time="09:00:00" end-time="18:00:00"></daily>
              <range start-date="2011-05-13" end-date="2011-05-26"></range>
            </recurrence>
          </schedule>
        </vdf:value>
      <vdf:field>  
    </vdf:payload>  
  </content>  
</entry>
Unsupported field types

Multiple value enumeration fields and link fields are not currently supported by the Content Engine web service. If you GET a content item containing fields of these types, the unsupported fields will be omitted from the VDF payload document.