Hi experts:
I must say that I've got a little experience using digester for XML
configuration files, but now I must populate some beans for a interface between
systems and it's really quite diferent.
I've also read about converters and my doubty come's just at that point.
Let me explain it.
Here's a part of my XML:
<?xml version="1.0" standalone="yes"?>
<Puma_Producto name="SourceKey_1" Datetime="Datetime_1" Action="Action_1">
<Datos CODE="CODE_1" DESCRIPTION="DESCRIPTION_1" TRATAMIENTO="TT1"
ESTADO="EST1" UNIDAD_FORECAST="UM2" CONVERSION="256"
UNIDAD_MEDIDA_COMPRAS="UM01">Datos_1</Datos>
I was able to pass the "CODE" and "DESCRIPTION" attributes to, setCode(String)
and setDescription(String) on my bean.
I was able to pass the "CONVERSION" to its corresponding setConversion(int).
But now I must pass "UNIDAD_MEDIDA_COMPRAS" to it corresponding
setUMCompras(UMCompras aValue) // it recieves a bean that I've got already
coded!
Here's my doubt about converters.
1) In yhe examples I saw, the converters where used when the "value" come in a
different entity, and now my value is set as an attribute.
Example:
<Puma_Producto name="SourceKey_1" Datetime="Datetime_1" Action="Action_1">
<Datos ..................... CONVERSION="256" UNIDAD_MEDIDA_COMPRAS="UM01">
<UNIDAD_FORECAST>UM2</UNIDAD_FORECAST>
</Datos>
But it's not my case!!
2) As I saw on Digester in the method convert(java.lang.String[] values,
java.lang.Class clazz) I cannot tell him the pattern I want to convert, in my
case: "Puma_Producto/Datos/UNIDAD_FORECAST"
3) Lastely, this is an answer, not a problem I had to deal with, is there any
way on digester to "iterate" over attributes and properties?? I mean, Digester
actualy returns an Object with all the entities readed "inside" according to my
configuration. But I can't do anything during that proccess. I want to receive
the values from the XML and execute the "set" methods by my self, is that
posible?
I hope I've relatively clear... excuse my if my English is not good enough.
Thanks in advance.