Home
TeamSite
using a .tpl to generate an .xml file
pawlr
I have a flash application that refers to an xml file for data. This xml file must have <![CDATA[ tags in it after it is generated... I want to use a dcr-tpl combination to generate this XML file but I'm getting template errors because I can't have <![CDATA[ tags in my .tpl without TS thinking they're for the .tpl!! (I wind up having double-opens and double-closes of <![CDATA[ and ]]>, respectively)
is there any way to "escape" a <![CDATA[ tag in my .tpl so it can be output in the resulting .xml file?
There's probably some totally different approach I don't know about, if someone could point me in the right direction it would be great..
Also I'm really thankful there's so many TS folks/experts who reply regularly, its making all the difference for us.. thanks again.
Find more posts tagged with
Comments
james1
In an <iw_perl> section, you can use iwpt_output() to emit any text you want, such as "<![CDATA[".
-- James
--
James H Koh
Interwoven Engineering
MattP
This sounds really interesting, and a great / innovative use of ts templating. I agree with James on the Perl iwpt_output. As well, you could use other logic such as, asp, jsp, maybe even JS (not sure if flash gets the code before the js executes) to write the tag at the time of request.
Good Luck
Matt
Matthew Petitjean
BOC Group
Murray Hill, NJ 07974 USA
Gregg Faus
I generally use the XML::Writer module to write out XML based off of DCR information.
For instance, I've got a master news template that will generate a summary XML file so that it can in turn be used for generating a news index page and for administrive tools (i.e. ability to put a front-end on the XML so users can edit news without knowing the DCR name).
I find that this module is the most efficient because it just writes XML and nothing else.
See here for more info:
http://search.cpan.org/author/DMEGG/XML-Writer-0.4/Writer.pm
gzevin
why doi you think it's so innovative? TST could essentially bring you any output, including XML.
some other suggestions - TST could be configured to produce custom XML straight away. Also, Data deploy could be also used....
Greg Zevin
Independent Interwoven Consultant/Architect
Sydney, AU
Gregg Faus
Nothing in PERL is innovative, so I'm not saying my method is the only way. I just think it is cleaner and easier to use.
I also don't use TST to produce XML directly because users don't know what they're looking at if they preview a template. They expect the look and feel of the generated page, not a xml document.