commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: [digester] Grabbing data from sub-element attributes
Date Fri, 13 May 2011 21:45:49 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

All,

Wouldn't you know it, just after I posted, I had an epiphany:

On 5/13/2011 5:33 PM, Christopher Schultz wrote:
> <entities>
>   <entity>
>     <foo>some value</foo>
>     <bar>some other value</bar>
>     <baz id="123" />
>   </entity>
> </entities>

The solution is:

digester.addObjectCreate("entities/entity", Entity.class);

digester.addSetNestedProperties("entities/entity",
                                { "foo", "bar", "baz" },
                                { "foo", "bar", null }); // ignore baz

// go back and get "baz"
digester.addSetProperties("entities/entity/baz", "id", "baz");

Sorry for the noise.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3Npo0ACgkQ9CaO5/Lv0PDG0ACgpYqGZOM054nO/bLNypyfrKPx
iysAnjqdjkrsQT4l3qlj1OLJp4vG4sbT
=n7/z
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message