Home
TeamSite
parse xml file
lukas123
hi,
i need to setup a template which generates an xml file. no problems with that.
but: parts of the content should come from a internal xml feed. so what i need to do is merge the output of the template xml with the internal xml feed. (get external.xml nodes and attach it to of template xml)
is there a way to do that? maybe when the user generates the page the files will be merged?
i've attached a sample structure.
thanks for the info
Find more posts tagged with
Comments
nipper
You need to fully think out this use case. From your description, you easily could open the file, strip off the Root tags, and put that data into the output. This is very trivial.
That being said, you are implying that the only way the output gets updated is when someoen in Teamsite regenerates the file. That *may* work in certain circumstances, I can also think of many cases when that will be unacceptable.
vy8359
You can use combination of placeholders/XSL/PT
Adam Stoller
If you want to handle it at page generation time - consider loading the external file as an alternate DCR (see docs on iwpt_load_dcr for details).
lukas123
thanks for your help. i will try out these different solutions.
i would have one more question
is it possible to load an external xml file?
pls see sample attached
right now i get the error:
Could not load drc: C:\default\main...\production/
http://localhost/feed.xml
is there a way that iwov doesnt use the standard path and instead just the url? (xml file is stored in the same domain, so no cross domain issues)
thanks!
nipper
iw_load_dcr loads DCRs. Amazing
If you read
http://yourserver/iw/help/tst/pt/TeamSite__PT__iw_load_dcr.html
you can learn to use it.
If you want to read any file, you can use Perl IO to do that. Now, IF you can get iw_load_dcr to find your external XML file, it *should* be able to parse it. To do that you will need to give a file path d:/Interwoven/iw-home/custom/project/xml/somefile.xml instead of an URL
lukas123
thats the problem.
i cant give a file name, i would like to put a url.
nipper
thats the problem.
i cant give a file name, i would like to put a url.
You can't.
Write some code to query a URL and drop the data received into a variable.
ISCBorisB
thats the problem.
i cant give a file name, i would like to put a url.
You'll need your XML somewhere in iwstore to use iw_load_dcr. If your XML is available through URL only, you can
instantiate HTTP Agent (like LWP::UserAgent), send http request(s) from your PT, get XML with response and parse it.