hi Arnaud,
        if i follow the approach of the mapping file,
but i am having problems in understanding it.
Ok, according to the docs and to what u said, i must
define my  SimpleAttribute as follows, right?

..
<class name="test.FList">
       <field name="SimpleAttribute" collection="hashtable"/>
       <field name="CollectionAttribute" collection="hashtable" />
    </class>


but i am missing some points: how can i then retrieve
the following SimpleAttribute

<SimpleAttribute>
     <name>foo</name>
     <value>foobar</value>
</SimpleAttribute>

?? if my class was generated thru SourceGenerator, i won't have
any put/get method for SimpleAttribute.

Somewhere i am missing something... can u give me some hints??

thanx in advance and regards
        marco









> -----Original Message-----
> From: ext Arnaud Blandin [mailto:[EMAIL PROTECTED]]
> Sent: 03. January 2002 11:05
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] beginner/ need suggestion on how to proceed
> with XML to Java mapping
> 
> 
> Hi Marco,
> 
> I don't know if this will help but you can use HashMap or HashTable in
> Castor by 
> 
> 1- using the collection attribute of the <field> element of 
> the Mapping
> File (please see the online documentation of the mapping file)
> 
> 2- if you can modify your object model, you still can abstract your
> collection in your object model by adding a method addXXX
> 
> public void addStuff(Stuff myStuff) {
>     _myMap.put(myStuff.getKey(), myStuff);
> }
> 
> 3- you can write your own FieldHandler and use the new 'handler'
> attribute of the <field> element in the mapping file, you can 
> search the
> archive for more info on that (search for java.util.HashTable). 
> 
> I hope this helps, if not don't hesitate to ask the list again for
> solutions,
> 
> Arnaud
> 
> -> -----Original Message-----
> -> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> -> Sent: Thursday, January 03, 2002 7:58 AM
> -> To: [EMAIL PROTECTED]
> -> Subject: [castor-dev] beginner/ need suggestion on how to proceed
> with XML to
> -> Java mapping
> -> 
> -> hi all,
> ->    i am a  beginner with Castor.
> -> Issue that i have to face is XML to Java mapping
> -> for my application.
> -> My application consists of different EJB running on WLS and
> -> one DispatcherEJB which forwards the request to the correct EJB.
> -> Flow of action is
> -> 
> -> Client---->Dispatcher--->EJB
> -> 
> -> Now, here is hte problem: i want to be able call EJBs using
> -> XML or Java Objects, that's why i was looking for an XML to
> -> java mapping.
> -> 
> -> problem is that the solution is towards a structure that
> -> resembles a java.util.Map, and in all the examples of
> -> XML to java mapping, the structure used is either a JavaBean
> -> or a Collection.
> -> I do not want to use Collection, since when the Dispatcher 
> will have
> -> mapped the XML to a JavaObject containing a Collection of 
> attributes,
> -> then the EJB to which this JavaObject is passed cannot fetch the
> -> attributes by name.
> -> So, can anyone suggest me the correct approach??
> -> 1 - shall i give up XML to java mapping and use instead only SAX?
> -> 2 - shall i still use XML to java mapping, and then i write some
> ->     sort of hard-coded loop in the EJB that have to process the
> JavaObject
> ->     so that i know exactly with which attribute i am dealing?
> -> 3 - is there some other way??
> -> 
> -> 
> -> hope someone can help me
> -> 
> -> thanx in advance and regards
> ->    marco
> -> 
> -> -----------------------------------------------------------
> -> If you wish to unsubscribe from this mailing, send mail to
> -> [EMAIL PROTECTED] with a subject of:
> ->    unsubscribe castor-dev
> 
> ----------------------------------------------------------- 
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>       unsubscribe castor-dev
> 

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to