The Instance - Eonic/ProteanCMS GitHub Wiki
The instance element in XForms represents the XML data structure to be updated by the form. In ProteanCMS, this often mirrors the structure of a database table, with individual fields that may contain XML data.
For example, fields like cContentXmlBrief
and cContentXmlDetail
hold the specific XML content that needs to be stored for a given piece of content.
If you want a single control in the form to update more than one value (e.g., updating both a "brief" and a "detail" section with the same title), you'll need to create multiple binds for that control. This ensures that changes are applied to all necessary XML nodes.
It's important to organize your instance in a logical and hierarchical order. Proper nesting of the XML structure makes it easier to reference and select the correct nodeset
for your binds. Below is an example of a well-structured instance:
- The root element
<tblContent>
contains various tags such asnContentKey
,dPublishDate
, andcDescription
. - Nested within
tblContent
, you may also have further nested elements likecContentXmlBrief
andcContentXmlDetail
, which store detailed content such asHeadline
,PublishDate
, andImages
.
Properly organizing your XML in this way makes it easier to manage content and bind controls in your XForm.
Below is a typical XML structure for an instance in ProteanCMS. Note how elements are nested to group related data logically.
- Elements like
Headline
,Strapline
, andImages
are part of bothcContentXmlBrief
andcContentXmlDetail
. - Tags that end with
/>
are self-closing and do not contain any further data.
<instance>
<tblContent>
<nContentKey/>
<nContentPrimaryId/>
<nVersion/>
<cContentForiegnRef/>
<cContentName/>
<cContentSchemaName>NewsArticle</cContentSchemaName>
<cContentXmlBrief>
<Content>
<Headline/>
<PublishDate/>
<Strapline/>
<Images>
<img class="thumbnail"/>
</Images>
</Content>
</cContentXmlBrief>
<cContentXmlDetail>
<Content>
<Headline/>
<PublishDate/>
<Strapline/>
<Body/>
<Images>
<img class="thumbnail"/>
<img class="display"/>
</Images>
</Content>
</cContentXmlDetail>
<nAuditId/>
<nAuditKey/>
<dPublishDate/>
<dExpireDate/>
<dInsertDate/>
<nInsertDirId/>
<dUpdateDate/>
<nUpdateDirId/>
<nStatus>1</nStatus>
<cDescription/>
</tblContent>
</instance>
-
Self-closing tags: Elements like
<nContentKey/>
and<PublishDate/>
are self-closing, meaning they don't contain inner content but act as placeholders for data. - Content organization: Organize the instance so that it logically reflects the structure of your content. This not only makes it easier to manage, but also simplifies the creation of binds that link form controls to the data.