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)
nested inline statements
ashokc
Can the 'xml' snippet to be included by an inline command, contain an another inline command? Does not look like it is allowed. For some reasons, that is the simplest way I can augment a lot existing datacaptire.cfg files with additional functionality. Thanks for any input.
Somewhat as follows:
datacapture.cfg:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE data-capture-requirements SYSTEM "E:\www\IWOV\datacapture5.0.dtd">
<data-capture-requirements type="content">
<ruleset name="Contact List">
<!-- Call the body code for this datacapture -->
<inline command="cat /opt/iw/dct_snipprts//contacts_dct_body.xml"/>
</ruleset>
</data-capture-requirements>
contacts_dct_body.xml:
<?xml version="1.0" encoding="UTF-8"?>
<substitution>
<description>Standard QCT online contact list.</description>
<item name="Page_Title">
<label>Page Title</label>
<description>Page title to be displayed on webpage.</description>
<text required="t" size="55"/>
</item>
<item name="Mail_Lists">
<label>Select the mail-list(s) that control access to this page</label>
<select multiple="t">
<inline command="/usr/bin/cat /opt/iw/resources/security_mail_lists"/>
</select>
</item>
</substitution>
security_mail_lists:
<?xml version="1.0" encoding="UTF-8"?>
<substitution>
<option label="low" value="0" selected="t"/>
<option label="medium" value="1" />
<option label="high" value="2" />
</substitution>
Find more posts tagged with
Comments
jbonifaci
No. Have you thought about doing this through FromAPI? You will receive better performance.
If you insist on doing it via inlines, you could create an inline script that:
1) Reads in the passed first xml file into $returnXml.
2) Check $returnXml for any inlines.
3) For each inline, execute the inline command and replace the inline element in $returnXml with the return from the inline execution.
4) Back to beginning of loop to check $returnXml for any inlines.
5) Once there are no more inline elements in $returnXml exit the loop and output the contents of $returnXml.
~Jeff
awizardly
This actually works just fine, we do it all the time. What you may try to do is actually remove the xml declarations from your substitution scripts.
It should look something like this.
<substitution>
<option label="low" value="0" selected="t"/>
<option label="medium" value="1" />
<option label="high" value="2" />
</substitution>
Remember there should only be 1 xml declaration per document. If you cat in the file with <?xml version="1.0" encoding="UTF-8"?> you will end up with multiple declarations in incorrect locations which the parser will puke on.
ashokc
Thank you. I did this with FORM API, and as you indicate this is perhaps better performance wise.
- ashok
ashokc
Thank you. It is good to know that this can be done. However in this case FORM API is perhaps better suited, because we would need it in anycase to preserve & show the previouly selected items in the dcr.
GH-Waitings.txt
Months.txt
Waitings List Sample.rptdesign
Mali
Hi,
Can I get the code of nested inline overcome from you?
Please send me.
Thanks in advance.
m. a. l. i.
TS 6.1 Win2k3
nagendra
Hi,
I am trying to acheive following nested inline calls <B>with out xml declaration<B>, even then following error is thrown( TS6.5, solaris, IE6)
Root cause:
com.interwoven.ui.formspub.datacapture.InvalidDCTException: Invalid Element: inline cannot appear at this level.
Details...
com.interwoven.ui.formspub.datacapture.InvalidDCTException: com.interwoven.ui.formspub.datacapture.InvalidDCTException: Invalid Element: inline cannot appear at this level.
at com.interwoven.ui.formspub.datacapture.dct.DCRDocumentBuilder.buildDocument(DCRDocumentBuilder.java:251)
at com.interwoven.ui.formspub.datacapture.DCRPredicate.buildDCRDocument(DCRPredicate.java:176)
at com.interwoven.ui.formspub.datacapture.NewDCRPredicate.execute(NewDCRPredicate.java:67)
at com.interwoven.ui.formspub.datacapture.NewDCRCommand.execute(NewDCRCommand.java:309)
at com.interwoven.ui.base.impl.command.CommandHandler.doExecuteCommand(CommandHandler.java:865)
at com.interwoven.ui.base.impl.command.CommandHandler.tryRunCommandDescriptor(CommandHandler.java:713)
at com.interwoven.ui.base.impl.command.CommandHandler.tryRunCommandID(CommandHandler.java:596)
at com.interwoven.ui.base.impl.command.CommandHandler.runCommand(CommandHandler.java:425)
==================================================================================================
<?xml version="1.0" standalone="no"?>
<!DOCTYPE datacapture SYSTEM "datacapture5.0.dtd">
<data-capture-requirements type="content" name="node">
<ruleset name="content">
<inline command="/bin/cat /data/software/iw/iw-home/btw/portalPage/xml/node_content.xml"/>
<script language="javascript" location="template-type" src="js/CommonUtils.js"/>
</ruleset>
</data-capture-requirements>
/data/software/iw/iw-home/btw/portalPage/xml/node_content.xml:
<substitution>
<item name="Title" rowcontinue="t">
<label>Title(max Chars 500)</label>
<database data-type="VARCHAR(500)" />
<text size="20" required="t" maxlength="500" />
</item>
<container name="Organisation">
<label>Organisation</label>
<inline command="/bin/cat /data/software/iw/iw-home/local/config/organisation.xml"/>
</container>
</substitution>
/data/software/iw/iw-home/local/config/organisation.xml :
<substitution>
<item name="Organisation Name">
<description>This item will have the name of the company for which this content is valid</description>
<select required="f">
<option label="None" value=""/>
<option label="T LTD" value="T LTD"/>
</select>
</item>
</substitution>
Is nested inline calls acheivable?
-nagendra
Adam Stoller
If you read Jeff's post in this thread you'd see you need to preprocess the nested inline statements yourself first, before [finally] returning the result from the original inline to the calling DCT.
So... Is it possible? yes. Is it supported? no.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
gzevin
as fish has said, it's definitely achievable, by using a pretty simple preprocessing script.
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
alanhill
Hi,
I've been struggling with the nesting of inline commands for a while now. You mention that you use Form API to get the results, can you give me a hint as to how you did that - I'm wracking my brain but can't think how to do that.
Many thanks
Alan
Teamsite Template Developer
jbonifaci
Alan,
I'm fairly certain he did not mean that he used formapi to allow him to use nested inlines. He meant that he used formapi instead of inlines. He is probably doing a callServer onFormInit that calls a script that populates the values of his items.
Now, if you want to actually use nested inlines, you would need to modify each of your inlines to parse their output before printing it and search for any other inline calles. They would need to then execute those inlines and replace the inline call with the return of the other inlines.
I would recommend against it if at all possible though, as forking off multiple perl processes could hurt your performance.
~Jeff
alanhill
Jeff,
I see what you mean, and a good point it is too.
I'm going to go down the route of scripting something to 'include' the generic code rather than nesting 'inline' elements. Hopefully what I'm planning to do will still allow the re-use of a lot of code and a reasonably time saving in development effort.
Thanks for the assistance.
Cheers
Alan
Teamsite Template Developer
JeremyH
An inline command simply runs a script that generates xml files.
What the script does is up to you. So, it would be no problem to create a script that reads a file, and then substitutes <inline cmd="..."> with the output of the command. This basic approach would be supported. (However, if you have trouble with your script, that would obviously not be supported.)
If you want to optimize performance, you can 'generate' a DCT ahead of time and include most of the nested files at once. This, however, would minimize dynamic content.
Another alternative would be to have a meta-inline script that handles all possible inlines. The script would be called from the DCT with appropriate parameters to process the initial inline code. As it processes the code, it would look for the inline statements and then perform the appropriate logic.
In the initial template:
<inline cmd="processInline.ipl /opt/iw/dct_snipprts//contacts_dct_body.xml"/>
The processinline.ipl would simply open and read the .xml file. Then it could substitute the nested inlines.
Adam Stoller
Are you responding to something I said?
As far as I can tell you're only supporting what I previously posted - which is that it's possible but not supported OOTB - and you'd have to do your own sub-inclusion processing.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
gzevin
I wrote a script that preprocesses the nested commands, executes them and removes all irrelevant XML tags
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
JeremyH
I think we're just considering different nuiances of unsupported. I consider something unsupported if it is a modification to IW code. If an IW update breaks your code, it is your tough luck.
The nested inline code is utilizing documented TeamSite APIs (the inline callout) IW would not support bugs in your initial code. However, if an IW update broke your code, then it is IWs duty to help provide a fix (or provide details on how their API has changed.)