I finally have found the chance to use Digester, and it's pretty impressive. However, there are a few issues that I'm confused about, and would appreciate the help.

Here's my XML:

<table name="pmw">
  <record id="1" name="pmw1"/>
  <record id="2" name="pmw2"/>
  <record id="3" name="pmw3"/>
</table>

<table name="por">
  <record id="5" type="6"/>
  ...
</table>


I'm using Digester to define my data to bulk load using commons-sql.


for each <record>, I want to do:

DynaBean bean = DynaSql.newInstance(../@name)

and then set the record's attributes into the corresponding DynaBean.


1) How can I do this? It seems that I can't access the parent element to use it's "name" attribute.


I realize that I can change my XML to accomplish this by adding a table attribute for each record. ( <record table="" id="" name=""/> ) But, I would like to avoid this redundancy.


2) Originally, I tried doing it in this way:


<pmw id="" name=""/>
<por id="" name=""/>
<anotherType id="" name=""/>

But I couldn't find a pattern to match each element. In looking at the examples, I'm thinking I could maybe do:

Digester.addFactoryCreate("?", MyFactory.class) using ExtendedRulesBase

or

Digester.addFactoryCreate("*", MyFactory.class) using the RegexRules?


Sorry for the abundance of questions. In the meanwhile, I'll keep looking at the examples and doing experiments to try and figure this out.


Thanks!



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



Reply via email to