Interpreting XML tag as HashMap
Ben Coburn <[email protected]> Wed, 23 Oct 2002 03:45:35 -0400 (EDT)
| Newsgroups | gmane.comp.java.enhydra.zeus |
|---|---|
| Message-ID | <[email protected]> |
Hello. Does Zeus have a way to specify that a set of child tags should be
stored as a "custom" HashMap in the parent tag when the classes are
generated? I keep finding situations where I need this feature. So far I
have resorted to building a HashMap after the fact in a wrapper class that
wraps the Zeus generated class. This is very tedious so I hope I've just
overlooked a capability of Zeus....
For example:
<example>
<foobar description="IMHO, this should be read as a HashMap.">
<foo key="moof" value="woof" true="1" />
<foo key="Hello" value="world" true="3" />
</foobar>
</example>
The idea is that the class Foobar would contain a HashMap of Foo objects
that are indexed by the attribute "key" on Foo. (I was originally thinking
of storing just value attributes hashed by key, but storing whole objects
is much more useful and versatile.) Note that one should be able to
specify any attribute as the key to hash the instances on.
Regards, Ben Coburn
/*------------------------------------------------------------
Ben_Coburn ([email protected]) {http://www.silicodon.net/};
------------------------------------------------------------*/