Re: Interpreting XML tag as HashMap

Christophe Contreras <[email protected]> Wed, 23 Oct 2002 11:24:36 +0200
Newsgroups gmane.comp.java.enhydra.zeus
Organization Laboratoire d'Informatique Fondamentale de Lille
Message-ID <[email protected]>
Hello Ben

Your "key" is really near to the ID/IDREF concept.
I have been quickly looking to this, because I need a system too that 
could help refering to XML elements that are identified by this kind of 
attribute; but it seems (or seemed, at the time I had a look) that Zeus 
is unable to deal with such attributes.

Your idea of a HashMap is quite good; mine was quite same, except I 
don't think having such a table inside an element is the best way to 
deal with ID/IDREF. I was thinking about an extern register that would 
be the manager of identified entities; and well, in fact I had this idea 
yesterday ;-)


It would be interesting if anyone has his own ideas to share them in 
there, since ID and IDREF are very usefull XML stuff...

So, comments are welcome! :-)

Regards,
Christophe


Ben Coburn wrote:
> 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/};
> ------------------------------------------------------------*/
> 
> 
> _______________________________________________
> Zeus mailing list
> [email protected]
> http://www.enhydra.org/mailman/listinfo.cgi/zeus
>