开发者

Digester rules xml to populate list of values

开发者 https://www.devze.com 2023-02-16 02:10 出处:网络
I have an SDO-like object that I need to parse with the help of digester rules. Object can have a list that stores same types as object itself e.g.

I have an SDO-like object that I need to parse with the help of digester rules. Object can have a list that stores same types as object itself e.g.

  class SdoLike{
     private List<SdoLike> listValue;

    public addListValueItem(SdoLike sdoLike){
        this.listValue.add(sdoLike);
       }
    }

How to define digester rules for that in xml?

<pattern value="ListValue">
            <object-create-rule classname="SdoLike"/>
                    <!--.......... -->
     开发者_JAVA百科       <set-next-rule methodname="addListValueItem"/>
    </pattern>

thanks.


So.. after some time

I placed a rule definition of SdoLike class into a separate file and

<pattern value="*/ListValue">
    <object-create-rule classname="tra.ta.ta.SdoLike" />
    <extended-include path="META-INF/digester/SdoLike.xml" />
    <set-next-rule methodname="addListValueItem" />
</pattern>

this pattern must not be nested into other patterns.

0

精彩评论

暂无评论...
验证码 换一张
取 消