You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Duncan Krebs <li...@krebsnet.com> on 2004/11/26 20:57:52 UTC

[Digester] xmlrulesets help!

Hi,
I have a group of different components and each one has a set of digester rules in an xml file. I like the idea of being able to reuse these rulesets in components that are built from other components. The way I am trying to go about this is using the <include> tag.

I'm having a tough time figuring out the right pattern matching rules to use so that xml rules will work independently as well as when they are included in another xml rule set. I would think wild card pattern matching could do this. Below are two xml rulesets (the second is the content that is referenced in the <include> tag in the first file) 

The issue I'm having is the object-create-rule in the second xml file does not get created. I don't see why this is because its using a wildcard pattern matching and it should not mater if its nested right? 
(I bolded the two critical rules that should provide the link) 

Any help would be much appreciated, instead of kicking back enjoying turkey last night I was trying to figure out how to digest xml. - Duncan 


<digester-rules>
<object-create-rule pattern="*/collectionwriter-session" classname="com.krebsnet.commons.excelwriters.wcollectionwriter.session.CollectionWriterSession"/>
<object-create-rule pattern="*/collectionwriter-session/columns/column/" classname="com.krebsnet.commons.excelwriters.wcollectionwriter.ExcelColumn"/>
<bean-property-setter-rule pattern="*/collectionwriter-session/columns/column/column-name" propertyname="columnName" />
<bean-property-setter-rule pattern="*/collectionwriter-session/columns/column/collection-property" propertyname="collectionProperty" />
<include **reference to file below***/> <!-- this file should create the "CellStyleRefObject"-->
<!-- next rule should have the cellStyleRef on top of the stack, but its not getting created-->
<set-next-rule pattern="*/collectionwriter-session/columns/column/cell-style" methodname="setCellStyleRef" />
<set-next-rule methodname="addExcelColumn" pattern="*/collectionwriter-session/columns/column/"></set-next-rule>
</digester-rules>

<!-- second xml file -->
<digester-rules>
<pattern value="*/cell-style">
<object-create-rule classname="com.krebsnet.commons.poibook.cellstyleref.CellStyleRef"/>
<pattern value="data-format">
<bean-property-setter-rule propertyname="dataFormat" />
</pattern>
</pattern>
</digester-rules>

example file below. 

<collectionwriter-session>
    <sheet-name>test</sheet-name>
    <skip-header>no></skip-header>
    <columns>
 <column
<column-name>column-represent</column-name>
<collection-property>myprop</collection-property>
<cell-style>
<data-format>0.00</data-format>
</cell-style>
</column>
</columns>
</collectionwriter-session>