hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Wannheden <knut.wannhe...@gmail.com>
Subject Re: Schema Object Manipulate Question
Date Wed, 25 May 2005 05:17:23 GMT
I'm almost surprised that we didn't already have a <push-content> :-)

+1

--knut

On 5/24/05, James Carman <james@carmanconsulting.com> wrote:
> I wouldn't mind just adding your push-content rule to HiveMind.  It seems
> logical enough.
> 
> 
> -----Original Message-----
> From: Hensley, Richard [mailto:Richard.Hensley@McKesson.com]
> Sent: Tuesday, May 24, 2005 5:44 PM
> To: hivemind-user@jakarta.apache.org
> Subject: Schema Object Manipulate Question
> 
> I have the following schema
> 
>     <schema id="ItemManager">
>         <element name="server" content-translator="object" />
>     </schema>
> 
> This above dictates the following xml:
> 
> <server>instance:package.class</server>
> 
> When I use it, I really want whatever the object provider produces using the
> contents as one of the elements in my configuration list.
> 
> The following works, but does not have the syntax that I desire.
> 
>     <schema id="ItemManager">
>         <element name="server">
>             <attribute name="server" translator="object" required="true" />
> 
>             <rules>
>                         <push-attribute attribute="server" />
>                 <invoke-parent method="addElement" />
>             <rules>
>         </element>
>     </schema>
> 
> The above dictates the following xml:
> 
> <server name="instance:package.class" />
> 
> Not really what I want. Does anybody have any suggestions?
> 
> 
> 
> At the moment I'm using the following custom rule.
> 
> public class PushContentRule extends BaseRule implements Rule {
> 
>     public void begin(SchemaProcessor processor, Element element) {
>         String value = RuleUtils.processText(processor, element, element
>             .getContent());
>         Translator t = processor.getContentTranslator();
>         Object finalValue = t.translate(processor.getContributingModule(),
>             Object.class, value, element.getLocation());
>         processor.push(finalValue);
>     }
> 
>     public void end(SchemaProcessor processor, Element element) {
>         processor.pop();
>     }
> }
> 
> with a schema that looks like.
> 
>         <element name="server" content-translator="object">
>             <rules>
>                 <custom class="util.PushContentRule" />
> 
>                 <invoke-parent method="addElement" />
>             </rules>
>         </element>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Mime
View raw message