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
