Hello Keith,
        Yes that worked fine as long as I use castor for
marshal/unmarshal.
In my usecase, I am using castor within axis for
serializing/deserializing objects./... and looks it's not working in
that case

Let me summarize..

I have generated, from the sample that you gave me below, a class that
has
One method, called addAnyObject(Object o) in which I can add any object

Now, In my application, I do following steps:
1 - build castor object
2 - give it to axis
3 - retrieve castor object from webservice
4 - operate on the  obtained castor object

as long as I am in step 2, I have inside my castor class values of type
that
I have added (string, integer, date etc..)

However, when I retrieve my castor object at step 3, what I have inside
my castor class are objects of type anyNode..

I am assuming that something is going 'wrong'  (or right, perhaps) in
the castor serializer.... (that I am getting from axis1.2beta..)

Can you pls help, or clarify how things are supposed to be working?

Thanks in advance and regards
        marco



-----Original Message-----
From: Keith Visco [mailto:[EMAIL PROTECTED] 
Sent: 05 November 2004 21:05
To: [EMAIL PROTECTED]
Subject: Re: [castor-user] SourceGenerator issue /2



Hi Marco,

I think you can use something like:

.
    <xsd:complexType>
       <xsd:sequence>
          <xsd:any minOccurs="0" maxOccurs="unbounded"/>
       </xsd:sequence>
    </xsd:complexType>
.

--Keith


Marco Mistroni wrote:
> Hello,
>       Sorry to spam the list but I have sent a message last week about
> one
> Issue with SourceGenerator and didn't get any reply
> I have to write a schema for an object that behaves like a java
> Collection,
> Meaning that It should contain 'Objects'
> 
> Basically, I want (castor to generate) a class with following method
> 
> public void addValue(Object object) 
> 
> from an XML schema
> 
> problem is that there is no way to write a schema that says 'this
> complexType should hold a collection of objects of type 'object'.
> I have checked, I could use xsd:anyType or xsd:IDREF.. it's ok in
> putting
> Values into my class, but whenever I retrieve the object that I have
> put, I get back a String representation.
> 
> Any suggestions on how to overcome htat problem? Writing custom Fields
> Handler? Custom Types?
> 
> Regards
>       Marco
> 
> FOR THOSE WHO ARE PATIENT, HERE IS THE BACKGROUND
> 
> I am using Castor together with Axis for marshalling/unmarshalling
> objects.
> My axis WS will use a 'PersistenceManager' class which is in charge of
> interacting with a  database.
> In case of a query, I am passing a set of parameters with which the
> Query should be populated. Since I want to keep my code 'not
dependent'
> on the query or on the type of objects, I am passing to my Persistence
> manager an array of Objects. The PersistenceManager picks those
objects
> and populate the query. (there's an article in javaworld by ryan
daigle
> for stuff like that)
> For using this code inside my webservice, I need Castor to create me
an
> object that behaves like a Collection, that holds Objects and not
> specific types..
> So far I haven't been able to get away with it.
> 
> 
> 
> 
> -----Original Message-----
> From: Werner Guttmann [mailto:[EMAIL PROTECTED] 
> Sent: 05 November 2004 09:29
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-user] Re: Date Format jdo and xml
> 
> 
> Charles,
> 
> there's one more alternative that just crossed my mind. Let's assume
you
> have a property x of type String in a class named X, along the lines
of 
> 
> class X {
> 
>    private String x;
> 
>    public void setX (String x) { ...}
> 
>    public String getX() { .. }
> 
> }
> 
> You could add two more methods 
> 
>    public Date getXasDate () { .. }
> 
>    public void setX (Date x) { ... }
> 
> and make Castor use the newly defined getter/setter by declaring
> get-method and set-method attributes on the >field> element.
> 
> Werner
> 
> On Fri, 5 Nov 2004 09:18:18 GMT, Charles Abell wrote:
> 
> 
>>Thanks Werner,
>>I had read it, but assumed it referred to a date stored as characters
> 
> in a database, to be converted to date in the object.
> 
>>Anyway the example gives me :
>>org.exolab.castor.mapping.MappingException: The SQL type d, is not
> 
> supported in this release
> 
>>Maybe it's easier to change the format using xsl.
>>
>>Charles
>>
>>
>>>Charles,
>>>
>>>have you ever read about parameterized type conversion at
>>>
>>>http://castor.exolab.org/types.html#Parameterized-Type-Convertors
>>>
>>>This might be a possible solution for your case.
>>>
>>>Werner
>>>
>>>On Thu, 4 Nov 2004 12:49:17 GMT, Charles Abell wrote:
>>>
>>>
>>>>Martin,
>>>>
>>>>Many thanks for the example, but regretfully not. I suspect the
>>>>difference is my mapping  has the extra line :
>>>><sql name="QU_DATE" type="date" dirty="ignore" />
>>>>
>>>>Stack trace is below.
>>>>
>>>>Best regards
>>>>
>>>>Charles
>>>>
>>>>org.exolab.castor.mapping.MappingException: No convertor exists
>>>>for converting type java.lang.String to type java.sql.Date
>>>>
>>>>at
>>>>
> 
> org.exolab.castor.jdo.engine.SQLTypes.getConvertor(SQLTypes.java:475)
> 
>>>>at
>>>>
> 
> org.exolab.castor.jdo.engine.JDOMappingLoader.getTypeInfo(JDOMappingLo
> 
>>>>ader.java:223)
>>>>
>>>>at
>>>>
> 
> org.exolab.castor.mapping.loader.MappingLoader.createFieldDesc(Mapping
> 
>>>>Loader.java:632)
>>>>
>>>>at
>>>>
> 
> org.exolab.castor.jdo.engine.JDOMappingLoader.createFieldDesc(JDOMappi
> 
>>>>ngLoader.java:246)
>>>>
>>>>at
>>>>
> 
> org.exolab.castor.mapping.loader.MappingLoader.createFieldDescs(Mappin
> 
>>>>gLoader.java:519)
>>>>
>>>>at
>>>>
> 
> org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(Mappin
> 
>>>>gLoader.java:343)
>>>>
>>>>at
>>>>
> 
> org.exolab.castor.jdo.engine.JDOMappingLoader.createDescriptor(JDOMapp
> 
>>>>ingLoader.java:147)
>>>>
>>>>at
>>>>
> 
> org.exolab.castor.mapping.loader.MappingLoader.loadMapping(MappingLoad
> 
>>>>er.java:212)
>>>>
>>>>at
>>>>
> 
> org.exolab.castor.jdo.engine.JDOMappingLoader.loadMapping(JDOMappingLo
> 
>>>>ader.java:295)
>>>>
>>>>at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:278)
>>>>
>>>>at
>>>>
> 
> org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseReg
> 
>>>>istry.java:289)
>>>>
>>>>at org.exolab.castor.jdo.JDO.getDatabase(JDO.java:559)
>>>
>>>



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



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

Reply via email to