The Instance - Eonic/ProteanCMS GitHub Wiki

Understanding the Instance in XForms

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.

Updating Multiple Values with a Single Control

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.

Best Practices for Nesting the Instance

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 as nContentKey, dPublishDate, and cDescription.
  • Nested within tblContent, you may also have further nested elements like cContentXmlBrief and cContentXmlDetail, which store detailed content such as Headline, PublishDate, and Images.

Properly organizing your XML in this way makes it easier to manage content and bind controls in your XForm.

Example XML Structure

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, and Images are part of both cContentXmlBrief and cContentXmlDetail.
  • 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>

Key Points to Note:

  • 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.


⚠️ **GitHub.com Fallback** ⚠️