commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Graham, Ryan - WMD" <ryan.gra...@ci.denver.co.us>
Subject [digester] nested element detection
Date Tue, 13 Dec 2005 23:00:48 GMT
Hi All,

I'm trying handle the following bit of xml but I'm having some trouble
doing so:

<log>
   <logitem timestamp="Fri Dec 09 14:16:18 MST 2005">
      <error from="...">
         <message>...</message>
      </error>
   </logitem>
   <logitem timestamp="Fri Dec 09 14:18:55 MST 2005">
      <warning from="...">
         <message>...</message>
      </warning>
   </logitem>
   <logitem timestamp="Fri Dec 09 14:30:05 MST 2005">
      <info from="...">
         <message>...</message>
      </info>
   </logitem>
</log>

I want to create an object for each logitem, set the timestamp, set the
type based on the next element (error, warning or info) and then get the
message text. I've tried to do something like this without much success:
      
digester.addObjectCreate("log/logitem", LogItem.class);
digester.addSetProperties("log/logitem", "timestamp", "timestamp");

//here is where I get stuck...
digester.addSetProperties("log/logitem/*", "type", "type");
digester.addSetNext("log/logitem ", "addLogItem");

Any help would be greatly appreciated.

Thanks,
Ryan

---------------------------------------------------------------------
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