commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luke Shannon" <lshan...@futurebrand.com>
Subject Re: Digester Quesion
Date Tue, 08 Feb 2005 20:27:14 GMT
Hi Wendy;

I need a little more advice. It seems I now need more than the item tag.

Here is a full xml sample:

<DATA>
<DEF>
  <TYPE>138</TYPE>
  <TYPES />
  </DEF>
<VERSION>
  <ITEM NAME="category" TYPE="text">Category 4</ITEM>
  <ITEM NAME="provider" TYPE="text">luke</ITEM>
  <ITEM NAME="progress_ref" TYPE="text">1100816505287</ITEM>
  <ITEM NAME="name" TYPE="text">ppt</ITEM>
  <ITEM NAME="desc" TYPE="text">dsfds</ITEM>
    <ITEM NAME="sort" TYPE="text">8</ITEM>
    <!-- an item like this one is optional -->
  <ITEM DIR="donutwars.ppt" HEIGHT="-1" NAME="kcfileupload" SIZE="9728"
STYPE="file" TYPE="upload" WIDTH="-1">donutwars.ppt</ITEM>
  </VERSION>
</DATA>

>From this I need:

1. As before a TreeMap containing @NAME (map key) and the value of the item
tag (map value).
2. If there is a SIZE attribute I need it.
3. I need the TYPE value now too.

What do you reccomend? Create a DATA object which contains a TreeMap for the
ITEMs, size variable for SIZE (if there is one) and a type variable for
TYPE?

Any tips you can give me would be great.

Luke



----- Original Message ----- 
From: "Wendy Smoak" <java@wendysmoak.com>
To: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
Sent: Monday, February 07, 2005 3:27 PM
Subject: Re: Digester Quesion


> From: "Luke Shannon" lshannon@futurebrand.com
>
> > What I end up back is a TreeMap containing the value of the ITEM@name as
> the
> > Map key and the value of <ITEM> as the Map value. Things were running
> > smoothly until I was told today that some <ITEM> contain a size
attribute.
> > Example:
> >
> >  <ITEM DIR="air3.pdf" HEIGHT="-1" NAME="kcfileupload" SIZE="117960"
> > STYPE="file" TYPE="upload" WIDTH="1">air3.pdf</ITEM>
>
> Right now you have a Map where the key/value pair is String/String,
correct?
> And in the example above, you're currently _only_ storing the 'NAME'
> attribute, and whatever is in the body of the <ITEM> tag?
>
> Didn't I talk you out of having an 'Item' class last week?  Looks like you
> need it again!  If an 'item' has more properties, it seems to me like
you'll
> need an Item 'bean', with get/set methods for the various properties.
>
> If you create an Item when you see DATA/VERSION/ITEM, then you can use the
> Item as the second parameter to 'put' on the TreeMap.  I have an example
of
> something similar-- it creates an ArrayList of LazyDynaBeans, you should
be
> able to adapt it to creating a TreeMap of Items.
>
> http://wiki.wendysmoak.com/cgi-bin/wiki.pl?DigesterLazyDynaBean
>
> -- 
> Wendy Smoak
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>



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


Mime
View raw message