commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diego <diego.mani...@xeridia.com>
Subject Problems with digester
Date Wed, 10 Mar 2004 12:32:31 GMT
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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message