开发者

Digester rules xml to populate list of values

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜