You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Steve McNally <sm...@silacom.com> on 2000/11/21 12:59:53 UTC
Dynamically creating an xml tree
Hi
I am trying to dynamically create an XML tree using a logic sheet.
I t works some thing like
<xsp:page language="java" xmlns:research="http://www.synamic.co.uk/News/v1"
xmlns:xsp="http://www.apache.org/1999/XSP/Core">
<page>
<news>
<date/>
<research:create-multiple-stories/>
</news>
</page>
</xsp:page>
When I match research:create-multiple-stories I want to call a java methd
that will loop through aresult set set and then create multiple stories
which should look like this
<story>
<category>fxwapalert</category>
<delay_time>3</delay_time>
<story_time>09:47</story_time>
<headline>[GBP/USD] Muted Rate</headline>
<language>Eng</language>
<summary>[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 - Exit:
1.4410 $$</summary>
<wap_summary>WAP[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 -
Exit: 1.4410 $$</wap_summary>
<full_text>31/10/00 09:40GMT [SPOT: 1.4500] Forecast for
Europe RES 3: 1.4750 ** [Band highs Oct] HIGH:1.4590 LOW 1.4410 RES 2:
1.4700 * [Round Number]. RES 1: 1.4585 [15 period high ma] MAJOR
TREND: Up SUP 1: 1.4466 * [34 day ma] .MINOR TREND: Flat SUP 2:1.4400 ** [Nr
term congestion] . SUP 3: 1.4318 * [27/10 low]. [FOCUS] - Y'days
action was negative with a longer upside wick and a small real candle body
at the foot of the range, a black one as well. This development has now
limited the upside generated from from 26th Oct. The
RSI is at 50 a neutral reading. This suggests further sideways
action</full_text>
<sms_summary>[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 - Exit:
1.4410 $$</sms_summary>
</story>
<story>
<category>fxwapalert</category>
<delay_time>3</delay_time>
<story_time>09:47</story_time>
<headline>[GBP/USD] Muted Rate</headline>
<language>Eng</language>
<summary>[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 - Exit:
1.4410 $$</summary>
<wap_summary>WAP[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 -
Exit: 1.4410 $$</wap_summary>
<full_text>31/10/00 09:40GMT [SPOT: 1.4500] Forecast for
Europe RES 3: 1.4750 ** [Band highs Oct] HIGH:1.4590 LOW 1.4410 RES 2:
1.4700 * [Round Number]. RES 1: 1.4585 [15 period high ma] MAJOR
TREND: Up SUP 1: 1.4466 * [34 day ma] .MINOR TREND: Flat SUP 2:1.4400 ** [Nr
term congestion] . SUP 3: 1.4318 * [27/10 low]. [FOCUS] - Y'days
action was negative with a longer upside wick and a small real candle body
at the foot of the range, a black one as well. This development has now
limited the upside generated from from 26th Oct. The
RSI is at 50 a neutral reading. This suggests further sideways
action</full_text>
<sms_summary>[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 - Exit:
1.4410 $$</sms_summary>
</story>
<story>
<category>fxwapalert</category>
<delay_time>3</delay_time>
<story_time>09:47</story_time>
<headline>[GBP/USD] Muted Rate</headline>
<language>Eng</language>
<summary>[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 - Exit:
1.4410 $$</summary>
<wap_summary>WAP[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 -
Exit: 1.4410 $$</wap_summary>
<full_text>31/10/00 09:40GMT [SPOT: 1.4500] Forecast for
Europe RES 3: 1.4750 ** [Band highs Oct] HIGH:1.4590 LOW 1.4410 RES 2:
1.4700 * [Round Number]. RES 1: 1.4585 [15 period high ma] MAJOR
TREND: Up SUP 1: 1.4466 * [34 day ma] .MINOR TREND: Flat SUP 2:1.4400 ** [Nr
term congestion] . SUP 3: 1.4318 * [27/10 low]. [FOCUS] - Y'days
action was negative with a longer upside wick and a small real candle body
at the foot of the range, a black one as well. This development has now
limited the upside generated from from 26th Oct. The
RSI is at 50 a neutral reading. This suggests further sideways
action</full_text>
<sms_summary>[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 - Exit:
1.4410 $$</sms_summary>
</story>
Has anyone got any ideas >?
Cheers
Steve
Steve McNally
m-commerce Consultant
Sila Communications
E-mail : Steve.McNally@Synamic.co.uk
Tel : 0207 796 7054
Re: Dynamically creating an xml tree
Posted by "Piroumian, Konstantin" <KP...@flagship.ru>.
> Hi
>
> I am trying to dynamically create an XML tree using a logic sheet.
>
> I t works some thing like
>
> <xsp:page language="java"
xmlns:research="http://www.synamic.co.uk/News/v1"
> xmlns:xsp="http://www.apache.org/1999/XSP/Core">
> <page>
> <news>
> <date/>
> <research:create-multiple-stories/>
> </news>
> </page>
> </xsp:page>
>
> When I match research:create-multiple-stories I want to call a java methd
> that will loop through aresult set set and then create multiple stories
> which should look like this
Why? You can call a simple Java class (like a JavaBean) with getXXX methods
and then you can create the XML with XSP:
<story>
<category>yourClass.getCategory()</category>
...
</story>
Something like that.
Otherwise you should create an XML Node object generate a string then parse
it into a Document Node and it to the current XML node. You can use Util
taglib for adding an XML string to your document:
<util:include-expr><util:expr>stringXml</util:expr></utils:include-expr>
Regards,
Konstantin Piroumian.
>
> <story>
> <category>fxwapalert</category>
> <delay_time>3</delay_time>
> <story_time>09:47</story_time>
> <headline>[GBP/USD] Muted Rate</headline>
> <language>Eng</language>
> <summary>[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 - Exit:
> 1.4410 $$</summary>
> <wap_summary>WAP[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 -
> Exit: 1.4410 $$</wap_summary>
> <full_text>31/10/00 09:40GMT [SPOT: 1.4500] Forecast for
> Europe RES 3: 1.4750 ** [Band highs Oct] HIGH:1.4590 LOW 1.4410 RES 2:
> 1.4700 * [Round Number]. RES 1: 1.4585 [15 period high ma] MAJOR
> TREND: Up SUP 1: 1.4466 * [34 day ma] .MINOR TREND: Flat SUP 2:1.4400 **
[Nr
> term congestion] . SUP 3: 1.4318 * [27/10 low]. [FOCUS] - Y'days
> action was negative with a longer upside wick and a small real candle body
> at the foot of the range, a black one as well. This development has now
> limited the upside generated from from 26th Oct. The
> RSI is at 50 a neutral reading. This suggests further sideways
> action</full_text>
> <sms_summary>[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 - Exit:
> 1.4410 $$</sms_summary>
> </story>
> <story>
> <category>fxwapalert</category>
> <delay_time>3</delay_time>
> <story_time>09:47</story_time>
> <headline>[GBP/USD] Muted Rate</headline>
> <language>Eng</language>
> <summary>[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 - Exit:
> 1.4410 $$</summary>
> <wap_summary>WAP[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 -
> Exit: 1.4410 $$</wap_summary>
> <full_text>31/10/00 09:40GMT [SPOT: 1.4500] Forecast for
> Europe RES 3: 1.4750 ** [Band highs Oct] HIGH:1.4590 LOW 1.4410 RES 2:
> 1.4700 * [Round Number]. RES 1: 1.4585 [15 period high ma] MAJOR
> TREND: Up SUP 1: 1.4466 * [34 day ma] .MINOR TREND: Flat SUP 2:1.4400 **
[Nr
> term congestion] . SUP 3: 1.4318 * [27/10 low]. [FOCUS] - Y'days
> action was negative with a longer upside wick and a small real candle body
> at the foot of the range, a black one as well. This development has now
> limited the upside generated from from 26th Oct. The
> RSI is at 50 a neutral reading. This suggests further sideways
> action</full_text>
> <sms_summary>[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 - Exit:
> 1.4410 $$</sms_summary>
> </story>
> <story>
> <category>fxwapalert</category>
> <delay_time>3</delay_time>
> <story_time>09:47</story_time>
> <headline>[GBP/USD] Muted Rate</headline>
> <language>Eng</language>
> <summary>[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 - Exit:
> 1.4410 $$</summary>
> <wap_summary>WAP[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 -
> Exit: 1.4410 $$</wap_summary>
> <full_text>31/10/00 09:40GMT [SPOT: 1.4500] Forecast for
> Europe RES 3: 1.4750 ** [Band highs Oct] HIGH:1.4590 LOW 1.4410 RES 2:
> 1.4700 * [Round Number]. RES 1: 1.4585 [15 period high ma] MAJOR
> TREND: Up SUP 1: 1.4466 * [34 day ma] .MINOR TREND: Flat SUP 2:1.4400 **
[Nr
> term congestion] . SUP 3: 1.4318 * [27/10 low]. [FOCUS] - Y'days
> action was negative with a longer upside wick and a small real candle body
> at the foot of the range, a black one as well. This development has now
> limited the upside generated from from 26th Oct. The
> RSI is at 50 a neutral reading. This suggests further sideways
> action</full_text>
> <sms_summary>[GBP]/[USD] Buy : 1.4460 - Obj: 1.4580 - Exit:
> 1.4410 $$</sms_summary>
> </story>
>
> Has anyone got any ideas >?
>
> Cheers
> Steve
>
> Steve McNally
> m-commerce Consultant
> Sila Communications
>
> E-mail : Steve.McNally@Synamic.co.uk
> Tel : 0207 796 7054
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>