3) is your best shot.  You must also pass castor your mapping file.
 
 
If you want Castor to generate .java files, then you  must pass a schema to the SourceGenerator.  I've only seen this code gen done at development time and not runtime.
So, you'll probably want to hand-create your java files.
 
However, here is a trick I did one time.
Create some sample xml.
Use castor's XMLInstance2Schema tool (or XMLSpy) to generate a schema.
pass the schema to the castor SourceGenerator. it will gen .java files for you.
throw away the schema file.
-----Original Message-----
From: Faisal Shoukat [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 07, 2004 9:47 AM
To: [EMAIL PROTECTED]
Subject: [castor-dev] Marshalling without a mapping file

Hi,

 

I am trying to use Castor to create a java object model and am wondering how to actually do this.  I am not using the source generator as I do not have a XML schema. 

 

1)       If I created a XML document then created a mapping file would Castor  generate the classes depending on the names of the elements within the XML document?

 

2)       Is it possible to just create an XML document and throw it at the marshaller? Will it create the required java classes without a mapping file?

 

3)       Do I have to create the java classes then create the mapping file and then give the marshaller the XML document and only then will it populate the java classes.

 

Can somebody please advice me which is the best way to create Java classes using Castor without a XML schema?

 

Thanks in advance.

 


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.596 / Virus Database: 379 - Release Date: 26/02/2004

Reply via email to