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.vizrt.com/types" model="http://host-ip-address/webservice/escenic/model/another"> <vdf:field name="TITLE"><vdf:value>Test</vdf:value></vdf:field> <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
|
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
where mime-type-list is a comma-separated list of allowed MIME types. |
|
not described in VDF model - see below. |
|
not described in VDF model - 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
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.vizrt.payload+xml"> <vdf:payload xmlns:vdf="http://www.vizrt.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>
Field options
Field options are included in the VDF payload document, embedded as
sub-fields of the fields to which they apply. They are, however,
currently not described in the VDF model. The following example shows a
vdf:field
element containing an embedded option
field:
<vdf:field name="summary"> <vdf:value>...</vdf:value> <vdf:field name="summary:css"> <vdf:value>...</vdf:value> </vdf:field> </vdf:field>
Note how the name of the embedded option field
(summary:css
) is formed by concatenating the name of
the parent field and the name of the option, using a colon as a
separator.
Multiple value enumeration fields
Multiple value enumeration fields are included in the VDF payload document, but they are not, however, currently described in the VDF model. The following example shows a multiple value enumeration field:
<vdf:field name="enum_multiple"> <vdf:list> <vdf:payload> <vdf:field name="enum_multiple"> <vdf:value>enum1</vdf:value> </vdf:field> </vdf:payload> <vdf:payload> <vdf:field name="enum_multiple"> <vdf:value>enum2</vdf:value> </vdf:field> </vdf:payload> </vdf:list> </vdf:field>