Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Iterating through the DCRs & creating an xml
arul
Hi,
I am trying to create an xml file that consists of values from all the DCRs within a data folder. The data folder has furthur subfolders which contain the DCRs. I want to iterate through all the DCRs, get the values from a couple of fields in each of the DCRs & populate the xml.
Does anyone know how this can be done?
Thanks,
Arul
Find more posts tagged with
Comments
nipper
sure write it.
What level of TS are you on ?
If you have 6.5, you *may* be able to use the enbedded search to get the fields out. If you have datadeploy experience, that could be useful, however I would just write a perl script to open each file recursivly grab the appropriate fields and spit out XML.
Andy
arul
Hi Andy,
I am on TS 5.5.2 on W2K.
Thanks,
Arul
Adam Stoller
As Nipper said - write it.
There's plenty of perl code floating around these forums and plenty of modules included with the iwperl distribution that provide most, if not all, of the functions you need to be able to implement what you're asking for.
Now you just have to sit down and code it.
Or were you expecting us to spoon-feed you code for free while you get paid for delivering it to *your* customer/organization?
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
nipper
>Or were you expecting us to spoon-feed you code for free while you get paid for delivering it to *your* customer/organization?
Why not, I do.
My customer's think I an a genius, thanks to Ghoti and many others on Devnet.
Andy
(It's great work when you can get it)
nipper
This should help you start:
http://devnet.interwoven.com/site.fcgi/techlib/052392
It is some code I wrote to walk through a directory structure looking for DCRs with certain fields containing
certain values.
You can easily modify it to get all the fields you need & then dump out XML.
There are perl modules that will generate XML, but if you are doing something fairly simple, I tend to
just hand code it.
Knock yourself out.
Andy
kshitiz
Hi,
You can do some perl coding to get a list of all the DCRs in the parent directory. You can use by using Unix
'find'
command in Perl.
Once you have the list of DCRs you can use some xml parser to get the values from each DCR and append them onto the required xml file.
Kshitiz Sharma
BT Wholesale | CMS
Mahindra British Telecom
arul
Thanks everyone for your help.
I finally used perl within the tpl file to iterate through the directory structure to get a listing of all the DCRs & then used TeamSite::XMLparser to parse through the DCRs and create the xml file and it works like a charm!
I had one question though. When you iterate through the directory structure in perl, it shows the first two folders/files as "." and "..". Does anyone know why it does that?
Thanks,
Arul
Migrateduser
. is the current directory,
.. is the immediate parent directory.