Suyati Technologies
  • Fluid Solutions
    • Buyer Rhythms Engine
    • Lead Prioritization
    • Customer LifeTime Value
    • Chatbot
    • Account Based Marketing
  • Platforms
    • CRM
      • Salesforce
      • Dynamics
    • CMS
      • Sitecore
      • Drupal
      • Episerver
      • Sitefinity
    • Ecom
      • Magento
      • Sitecore commerce
    • RPA
      • UiPath
    • Analytics
    • Martech
  • Services
    • CX Consulting
    • DSaaS
    • Product Engineering
  • Intel
    • Blog
    • eBooks
    • Webinars
    • Case Studies
  • About Us
    • Management Team
    • Advisory Board
    • Our Story
    • Testimonials
  • Careers
Suyati Technologies
  • Fluid Solutions
    • Buyer Rhythms Engine
    • Lead Prioritization
    • Customer LifeTime Value
    • Chatbot
    • Account Based Marketing
  • Platforms
    • CRM
      • Salesforce
      • Dynamics
    • CMS
      • Sitecore
      • Drupal
      • Episerver
      • Sitefinity
    • Ecom
      • Magento
      • Sitecore commerce
    • RPA
      • UiPath
    • Analytics
    • Martech
  • Services
    • CX Consulting
    • DSaaS
    • Product Engineering
  • Intel
    • Blog
    • eBooks
    • Webinars
    • Case Studies
  • About Us
    • Management Team
    • Advisory Board
    • Our Story
    • Testimonials
  • Careers
Suyati Technologies > Blog > DeSerialization of Smartform Contents in Ektron

DeSerialization of Smartform Contents in Ektron

by Bisileesh Bhaskaran May 8, 2013
by Bisileesh Bhaskaran May 8, 2013 0 comment

Smartforms are one of the important Content Types in Ektron. They are basically meant to structure or model the content, which allows the content authors to create structured contents. Thus they will separate the content from presentation.
Let us look into content modelling using Smart from with the following example,
Suppose you have an online Entertainment news website, the news contents that appears in this website should have the following attributes:
• News Title
• News Author Name
• News Content
• News Image
• News Summary
• News Date.etc
A typical Entertainment News content:

news

Image Source: www.debbiereganlocations.com


In the above example certain attributes are mandatory. For example News Content, Author Name, Date,.etc.And the rest of them are optional.
The content authors may miss some of the required attributes while creating the content, or may not provide the needed styling for the content. Thus a non-structured content will become a headache for the whole system.
Smart forms will rectify all these issues by providing a model to the content. It forces the content to be of a certain format.
Now let us create a New Smartform definition in the workarea with the above fields.
View SF config
Now we will create a “News Content” with this Smart form,
SF Content
Now the question is how to retrieve the Smartform content data? Mostly Ektron developer seems to be comfortable with the following three approaches.

  • Approach -1:

Generate Class for SmartForm
This approach refers to creating a class from the XML Defnition Schema of the Smart form configuration,which can be obtained from the smartorm designer in the workarea.
Generate class from the xsd by using
• Xsd.exe or
• Xsd2Code .net class generator from XSD schema
The xsd schema for our sample Smart Form looks like the following:
<xs:schema elementFormDefault=”qualified” attributeFormDefault=”unqualified” xmlns:xs=”http://www.w3.org/2001/XMLSchema”>
<xs:element name=”root”>
<xs:complexType>
<xs:sequence>
<xs:element name=”News”>
<xs:complexType>
<xs:sequence>
<xs:element name=”Title” type=”xs:string” />
<xs:element name=”Author” type=”xs:string” />
<xs:element name=”Content” type=”xs:string” />
<xs:element name=”Date” type=”dateOrBlankType” />
<xs:element name=”Image”>
<xs:complexType>
<xs:sequence>
<xs:element name=”img” type=”imgDesignType” minOccurs=”0″ />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name=”Summary” type=”xs:string” />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name=”dateOrBlankType”>
<xs:union memberTypes=”xs:date”>
<xs:simpleType>
<xs:restriction base=”xs:string”>
<xs:length value=”0″ />
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:attributeGroup name=”coreattrs”>
<xs:attribute name=”id” type=”xs:ID” />
<xs:attribute name=”class” type=”xs:NMTOKENS” />
<xs:attribute name=”style” type=”xs:string” />
<xs:attribute name=”title” type=”xs:string” />
</xs:attributeGroup>
<xs:attributeGroup name=”i18n”>
<xs:attribute name=”lang” type=”xs:language” />
<xs:attribute name=”dir”>
<xs:simpleType>
<xs:restriction base=”xs:token”>
<xs:enumeration value=”ltr” />
<xs:enumeration value=”rtl” />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:attributeGroup>
<xs:attributeGroup name=”attrs”>
<xs:attributeGroup ref=”coreattrs” />
<xs:attributeGroup ref=”i18n” />
</xs:attributeGroup>
<xs:simpleType name=”ImgAlign”>
<xs:restriction base=”xs:token”>
<xs:enumeration value=”top” />
<xs:enumeration value=”middle” />
<xs:enumeration value=”bottom” />
<xs:enumeration value=”left” />
<xs:enumeration value=”right” />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name=”Length”>
<xs:restriction base=”xs:string”>
<xs:pattern value=”[-+]?(d+|d+(.d+)?%)” />
</xs:restriction>
</xs:simpleType>
<xs:complexType name=”imgDesignType”>
<xs:attributeGroup ref=”attrs” />
<xs:attribute name=”src” use=”required” type=”xs:anyURI” />
<xs:attribute name=”alt” type=”xs:string” />
<xs:attribute name=”height” type=”Length” />
<xs:attribute name=”width” type=”Length” />
<xs:attribute name=”align” type=”ImgAlign” />
<xs:attribute name=”border” type=”Length” />
<xs:attribute name=”hspace” type=”xs:nonNegativeInteger” />
<xs:attribute name=”vspace” type=”xs:nonNegativeInteger” />
</xs:complexType>
</xs:schema>
Once the corresponding class is created with the XSD, it is possible to De-serialize the smartform content to corresponding class.
And from the De-serialized entity, the data can be accessed as corresponding class members.
For example,
public void ClassHandling()
Image1

  •  Approach-2:

XML Parsing: 
Another approach is parsing the XML data of the smartform content,as the smartform contents are enforced to have XML data,this can be pulled programmatically and can be parsed to obtain the required data.
The XML of the Sample Smartform content looks like this:
Image2
 
The XML data of the corresponding Smartform content can be accessed from the ContentData class from the ContentManager framework class.
The XML parsing can be done in different ways as there are number of classes in the .NET framework to work with XML.
According to the Best practice strategy, it is better to make use of the XPathNavigator class as is much efficient in performance perspective, as it doesn’t provide any editing capabilities.
Sample code looks like the following:
Image3

  • Approach-3:

By using JSON
This is another alternate approach to De-serialize the smartform content data.This approach refers to transforming the XML data of the smartform content into JSON format.The primary advantage of this approach is client side data binding by leveraging the parsing capabilities of JSON.
CodeBehind:
Image4
 
ASPX Page:
<form id=”form1″ runat=”server”>
Image5
</form>
Thus by using this approach the smartform content data binding can be done from client side.
Happy Coding!!!
Sources: 

  • OLD TRICKS – XSLT FILES AND SMART FORMS
  • EKTRON SMARTFORM XML TO JSON

 

.netC#EktronXML
0 comment
0
FacebookTwitterLinkedinTumblr
previous post
Content Translator Smart Desktop Widget For Ektron
next post
When to Put Big Data in the Cloud

You may also like

Outsourced Remote Resources Are Exceptionally Productive. How?

March 2, 2021

6 Effective Tips To Use Salesforce For Customer...

February 24, 2021

How CIOs Leverage Technology to Focus on Customer...

February 22, 2021

Identifying the Right Use Case for RPA in...

February 17, 2021

5 Tips to Future Proof Your Resource Pipeline

January 28, 2021

Best Practices to make the most out of...

January 27, 2021

How to Find the Right Offshore Development Team...

January 19, 2021

Most Viewed Blogs of 2020

January 13, 2021

Top 10 ETL Tools for Salesforce Data Migration...

January 4, 2021

How to Make the Most Out of Salesforce...

December 23, 2020

Leave a Comment Cancel Reply

Save my name, email, and website in this browser for the next time I comment.

Keep in touch

Twitter Linkedin Facebook Pinterest

Recent Posts

  • Outsourced Remote Resources Are Exceptionally Productive. How?

    March 2, 2021
  • 6 Effective Tips To Use Salesforce For Customer Retention

    February 24, 2021
  • How CIOs Leverage Technology to Focus on Customer Success

    February 22, 2021

Categories

  • Twitter
  • Linkedin
  • Facebook
  • Instagram
  • Fluid Solutions
    • Buyer Rhythms Engine
    • Lead Prioritization
    • Customer LifeTime Value
    • Chatbot
    • Account Based Marketing
  • Platforms
    • CRM
      • Salesforce
      • Dynamics
    • CMS
      • Sitecore
      • Drupal
      • Episerver
      • Sitefinity
    • Ecom
      • Magento
      • Sitecore commerce
    • RPA
      • UiPath
    • Analytics
    • Martech
  • Services
    • CX Consulting
    • DSaaS
    • Product Engineering
  • Intel
    • Blog
    • eBooks
    • Webinars
    • Case Studies
  • About Us
    • Management Team
    • Advisory Board
    • Our Story
    • Testimonials
  • Careers

© 2020 Suyati Technologies


Back To Top
Suyati Technologies

Popular Posts

  • 1

    What are the Top 3 risks for implementing a CX Program?

    August 30, 2019
  • 2

    What is Salesforce CRM and What Does it Do?

    February 19, 2014
  • 3

    Do you need a separate CX Team at your company?

    September 2, 2019
  • 4

    How to build Employee Advocacy for your Business?

    September 3, 2019
  • 5

    Tips to Reduce Salesforce Pricing

    February 17, 2015
© 2020 Suyati Technologies

Read alsox

IT Spend in India to Scale New Heights!

October 17, 2012

E-commerce Packaging – The Do's and Dont's

January 13, 2016

Leveraging Lightning Design System for Salesforce Applications

November 21, 2018
Suyati Logo

Technology Insights. Delivered.

Know more about business technology platforms for your enterprise.

Thank you!

We're glad to have you as part of our community. Please feel free to contact us anytime with feedback or suggestions.

Suyati Logo

Leaving So Soon?

Know more about business technology platforms for your enterprise.

Thank you!

We're glad to have you as part of our community. You'll start receiving updates shortly. Please feel free to contact us anytime with feedback or suggestions.

By continuing to use this website you agree with our use of cookies. Read More Agree