Hello Diego,
 
you can use a call method rule instead e.g. like this:
digester.addCallMethodRule("class/property/meta", "setData", 0, "java.lang.String");
Paramcount = 0 will call the setData method on your Meta-Object using the body of your 
meta tag...
 
Hope this works... ;-)
 
Bye,
CK

        -----Urspr�ngliche Nachricht----- 
        Von: Diego [mailto:[EMAIL PROTECTED] 
        Gesendet: Mi 10.03.2004 13:32 
        An: [EMAIL PROTECTED] 
        Cc: 
        Betreff: Problems with digester
        
        

        Hi everyone!
        
        I'm using commons digester to parse a xml file like this:
        
        <class>
            <property>
                <meta attribute="field-description">data1</meta>
                <meta attribute="field-description">data2</meta>
            </property>
        </class>
        
        I'm having problems getting the body of "meta" tags. I just get "null".
        
                        digester.addObjectCreate(
                                "class/property/meta",
                                Meta.class);
                        digester.addSetProperties(
                                "class/property/meta",
                                "attribute",
                                "type");
                        digester.addBeanPropertySetter(
                                "class/property/meta",
                                "data");
                        digester.addSetNext(
                                "class/property/meta",
                                "addMeta");
        
        In the Meta class I have defined two String fields, "data" and "type", with
        their respective getters and setters. The addMeta method is correctly defined
        in
        the Property class, but when I set a breakpoint in this method, the Meta object
        comes with the "data" field set to null. The "type" is parsed correctly.
        
        I think the problem is in this statement:
        
                        digester.addBeanPropertySetter(
                                "class/property/meta",
                                "data");
        
        In all the digester examples I've seen, the addBeanPropertySetter is used to
        pick the body of tags nested into the "object tag", and not the object tag
        itself.
        
        What am I doing wrong?
        
        thanks in advance
        
        ----------------------------------------------------------------
        This message was sent using IMP, the Internet Messaging Program.
        
        
        ---------------------------------------------------------------------
        To unsubscribe, e-mail: [EMAIL PROTECTED]
        For additional commands, e-mail: [EMAIL PROTECTED]
        
        


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

Reply via email to