Converting Xml to Json in Teamsite
Hi ,
My requirment is to convert my dcrs(xml ) files into json file. Is this possible with the help of tpl?
My approach is to make DCRs of my webinars. Then I need this webinars on my home page with lot of other functionality on the same like filtering , sorting etc.
So I am asked to try if I can convert these XML into JSON file using tpl file. Is this is possible any how??
Thanks in Advance!
Comments
-
You can find sample code to convert xml to json online. Or use some Perl modules which does the same. Then use it in your tpl and generate the json!
regards,
Praveen
0 -
There's not any smarts to this, and I don't think solutions you find on the internet will really help you with your TPL work. You might be able to find an XSL sample though. However since you have full control of the transformation either way, it's just a matter of actually doing it.
That said, if you don't need to use TPL/XSL, you could do this in workflow directly. The product includes (an old version of) a library from json.org which will basically do all the work for you. It'd be super easy to wrap an external task around this.
http://www.json.org/java/index.html
0 -
Why not just create a second .tpl file that generates json? You just need to add it to the templating,cfg file.
<presentation>
<template name="example.tpl" extension="json">
<locations>
<branch vpath-regex=".*" preview-dir="/subs/home">
<directory dir-regex=".*"/>
</branch>
</locations>
</template>
</presentation>0 -
I am facing a similar issue.
I have generated a json output from the XSL in presentation template.
The extension is set as .json and the <xslutput> tag is set to json. But I get the
<?xml version="1.0" encoding="UTF-8"?>
on the start of each file. Also when I edit the file in teamsite, it opens the DCR rather than the json file.
Can you let me know where do I have to change and what do i have to change?
Thanks to you all in advance!
0 -
User921526, use omit-xml-declaration in your xsl.
0
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 151 General Questions
- 148 Thrust Services
- 57 OpenText Hackathon
- 37 Developer Tools
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 32 eDOCS
- 186 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 8 XM Fax
- Follow Categories
- Docker Automation
- LiveSite Content Services (LSCS) REST API
- Single Page Application (SPA) Modules
- TeamSite Add-ons
If you are interested in gaining full access to the content, you can register for a My Support account here.