DD4T 2.0 – Generating XML output from Templates

One of the major advantage DD4T 2.0 is producing the rendered output in the JSON format and removing unnecessary tags/data so as to have a smaller payload while publishing.

Although, till meta-version of DD4T 2.0, the output of Templates can be generated in JSON as well as in XML format, however, in the main release this option has been smartly removed and may have very valid reasons behind it.

On the other side, if you are in real need of getting the XML output (of course at the expense of quite good benefits that DD4T 2.0 provides) then you can follow below simple steps:

  • Open CME and navigate to the location where all DD4T 2.0 Templates, TBB and Schema have been installed.
  • Open the Parameter Schema – Generate dynamic component – to edit
  • Add a new Field of type Text with xml name as SerializationFormat. Also configure this field to select its value from a List with the list have two values – JSON, XML.
    The below image depicts this:
    XmlInDD4T
  • Now open the Component Template for which you want to render the output in the XML Format in the Template Builder tool to edit
  • Once in Template Builder, select the Template Building Block (TBB) – Generate dynamic component
  • Change the parameter value for this newly added field – SerializationFormat – as XML and “Save & Close” the template. Below screen shot illustrates this:
    paramXML
  • That’s it – you are done and now the output of this specific template will be generated in XML format.

Note: If no value is selected for the parameter – SerializationFormat – then by default the output will be rendered in JSON format.

Advertisements

Director at Content Bloom India having 12+ years of experience in Software Development Life Cycle using AGILE, Iterative and RUP approaches. Experience in following: - CMS packages: SDL Tridion, Adobe Experience Manager (AEM), Sitecore, Umbraco, Kentico, and Alfresco - Search Engines: SOLR, AWS Cloud Search, Elastic Search - .NET Technologies: .NET & .NET CE Framework, ASP.NET, ASP.NET MVC, WCF, WinForms - Mobile Development: Android Native App, Windows Mobile App - Database: MS-SQL Server, MySQL - Program Management: JIRA, MS-Project, Trello - Design Tools: MS-Visio, StarUML - Infrastructure: Linux, Windows Server, AWS Have decent knowledge about Core Java, Spring MVC Instrumental in Application Architecture, Designing (HLD & LLD), Coding and deployment .NET applications (Web, Desktop, Mobile). Experience in following domain: - Digital Media & eCommerce - Travel & Hospitality - Aviation Industry - Education - Insurance - Automation - Automobile - Railways Education: Bachelor Degree in Computer Engineering and Post Graduate Diploma in Business Administration with specialization in Marketing

Posted in SDL Tridion

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: