Hi, 

It looks as if digester provides prebuilt rules to set properties in one of
two ways - either using the value of an XML attribute, or using the value of
a nested XML element.

What I'm trying to do is use a nested element.  But, the value of the XML
element is not the value I want to set the property to; instead, it is a
key, which should be used to retrieve an object from a HashMap.  That
retrieved object is then what I want to set the property value to.

I don't think there is a rule which can easily be adapted to do this
(although I'd love to be proven wrong).  Can someone give me a quick set of
steps for creating a new rule that would behave this way?

(ignore the remainder if you're not interested in 'why')

What I'm trying to do is this.  Let's say I'm trying to set up a series of
mailing lists (which is actually only part of what I'm trying to do, but
sufficient to illustrate the problem).  Particular subscribers may be on
multiple lists, and I didn't want to repeat the same information over and
over within the XML config.  (I realize that 'concise' and 'XML' are
mutually exclusive, but I'm trying to eliminate needless repetition anyway).

So, I have a structure somewhat like
  <config>
     <person>
        <name />
        <email />
     </person>
     <!-- several more people defined -->

     <list> 
         <name />
         <person />
         <person />
     </list>
   </config>

So, as I digest the file, I create a Collection of Persons.  Each person is
added to a HashMap using their name as a key.  That part works great.  Then,
I start digesting the lists.  When I find a person entry, it contains a
name.  But I don't want to just put the name into my List object - I want to
use that name to retrieve the Person object created earlier, and insert a
reference to that object in the List.

Possible?  Reasonable?  

Thanks,
Mike

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to