commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike J Dougherty <>
Subject Digester: attribute -> class.field mapping
Date Fri, 01 Sep 2006 02:05:42 GMT
I'm not real sure how to ask this question, so let me post some sample 
code and maybe it will help:

Here are the classes:

public class Top {
        private Foo value = null;
        public void setValue(Foo value) { this.value = value; }
        public Foo  getValue()          { return value; }

public class Foo {
        private String bar = null;
        public void   setBar(String str) { = str; }
        public String getBar()           { return bar; }

Here's the input XML:

  <top foo="MyFoo"><![CDATA[Some text]]></top>

And here are the rules I've some up with so far:

  <pattern value="top">
        classname="Top" />
    <pattern value="@foo">
      <object-create-rule classname="Foo" />
      <set-properties-rule />
      <call-method-rule methodname="setBar" paramcount="0"/>
    <set-next-rule methodname="setValue" />

What I want is to map the value of the "foo" attribute ("MyFoo") to, and then set that instance of the Foo object to Top.value. In 
the end: topInstance.getFoo().getBar().equals("MyFoo") == true.

I've looked at the docs, example, and googled on this, and do not see an 
obvious way to accomplish my objective. Is this possible? If so, what 
would the rules be?

Thanks for your time.

 Mike Dougherty
 mjdougherty at gmail dot com

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message