I'm almost surprised that we didn't already have a <push-content> :-)
+1 --knut On 5/24/05, James Carman <[EMAIL PROTECTED]> wrote: > I wouldn't mind just adding your push-content rule to HiveMind. It seems > logical enough. > > > -----Original Message----- > From: Hensley, Richard [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 24, 2005 5:44 PM > To: [email protected] > 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
