Castor To Create Java Files From XML/XSD

View: New views
7 Messages — Rating Filter:   Alert me  

Castor To Create Java Files From XML/XSD

by sia :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello,

Kind of new with this, so here goes. I have a project that is currently using JAXB and our team would like to switch to Castor. The way this works is we have a XML document with some XML Schema tags in it that we used with JAXB.

I would like to be able to generate the java files for this using Castor and then of course have castor unmarshall the forms at a later time.

I have searched the docs, and do not see how this is accomplished. I worked through the tutorial, and all I see is how to make the XSD while marshalling the data, but the team wants to create their own XML and have castor create the java from it.

Thanks,
Scott


CONFIDENTIALITY NOTICE
This e-mail message and any attachments are only for the use of the intended recipient and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient, any disclosure, distribution or other use of this e-mail message or attachments is prohibited. If you have received this e-mail message in error, please delete and notify the sender immediately. Thank you.

Re: Castor To Create Java Files From XML/XSD

by Werner Guttmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Scott,

before pointing you to the right places, let me ask you a few questions:

a) How would you want to trigger the code generation ? In other words,
what build environment are you using ? Ant ? Maven ?

b) Is it just one XML schema, or a set of XML schema files from which
you want Java code to be generated ? If more than one, is this a
disjunct set, or is there e.g. a master schema that includes/imports all
the other XML schemas ?

Regards
Werner

Scott Purcell wrote:

> Hello,
>
> Kind of new with this, so here goes. I have a project that is currently
> using JAXB and our team would like to switch to Castor. The way this works
> is we have a XML document with some XML Schema tags in it that we used
> with JAXB.
>
> I would like to be able to generate the java files for this using Castor
> and then of course have castor unmarshall the forms at a later time.
>
> I have searched the docs, and do not see how this is accomplished. I
> worked through the tutorial, and all I see is how to make the XSD while
> marshalling the data, but the team wants to create their own XML and have
> castor create the java from it.
>
> Thanks,
> Scott
>
>
>
> CONFIDENTIALITY NOTICE
> This e-mail message and any attachments are only for the use of the intended recipient and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient, any disclosure, distribution or other use of this e-mail message or attachments is prohibited. If you have received this e-mail message in error, please delete and notify the sender immediately. Thank you.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Castor To Create Java Files From XML/XSD

by Werner Guttmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Scott,

one more question ....

Werner

Scott Purcell wrote:
> Hello,
>
> Kind of new with this, so here goes. I have a project that is currently
> using JAXB and our team would like to switch to Castor. The way this works
> is we have a XML document with some XML Schema tags in it that we used
> with JAXB.
Actually, would you be willing to share with is why you are switching
away from JAXB ?

>
> I would like to be able to generate the java files for this using Castor
> and then of course have castor unmarshall the forms at a later time.
That's an out-of-the box feature of Castor in that you will be able to
use the generated Java classes (mainly two Java classes per global XML
schema artefact) to unmarshal from and marshal to your XML document
instances (incl. object-level validation, etc.).

>
> I have searched the docs, and do not see how this is accomplished. I
> worked through the tutorial, and all I see is how to make the XSD while
> marshalling the data, but the team wants to create their own XML and have
> castor create the java from it.
>
> Thanks,
> Scott
>
>
>
> CONFIDENTIALITY NOTICE
> This e-mail message and any attachments are only for the use of the intended recipient and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient, any disclosure, distribution or other use of this e-mail message or attachments is prohibited. If you have received this e-mail message in error, please delete and notify the sender immediately. Thank you.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Castor To Create Java Files From XML/XSD

by sia :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thanks Werner for the email.

I discussed this with my teammates, and they would like to use Ant to generate the  source.
And currently it is just one XML Schema (today) but they anticipate many XML Schemas down the road. And they would all be disjunct no master per sey.

Thanks,
Scott





Werner Guttmann <werner.guttmann@...>

07/01/2008 03:42 PM
Please respond to
user@...

To
user@...
cc
Subject
Re: [castor-user] Castor To Create Java Files From XML/XSD





Scott,

before pointing you to the right places, let me ask you a few questions:

a) How would you want to trigger the code generation ? In other words,
what build environment are you using ? Ant ? Maven ?

b) Is it just one XML schema, or a set of XML schema files from which
you want Java code to be generated ? If more than one, is this a
disjunct set, or is there e.g. a master schema that includes/imports all
the other XML schemas ?

Regards
Werner

Scott Purcell wrote:

> Hello,
>
> Kind of new with this, so here goes. I have a project that is currently
> using JAXB and our team would like to switch to Castor. The way this works
> is we have a XML document with some XML Schema tags in it that we used
> with JAXB.
>
> I would like to be able to generate the java files for this using Castor
> and then of course have castor unmarshall the forms at a later time.
>
> I have searched the docs, and do not see how this is accomplished. I
> worked through the tutorial, and all I see is how to make the XSD while
> marshalling the data, but the team wants to create their own XML and have
> castor create the java from it.
>
> Thanks,
> Scott
>
>
>
> CONFIDENTIALITY NOTICE
> This e-mail message and any attachments are only for the use of the intended recipient and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient, any disclosure, distribution or other use of this e-mail message or attachments is prohibited. If you have received this e-mail message in error, please delete and notify the sender immediately. Thank you.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email






CONFIDENTIALITY NOTICE
This e-mail message and any attachments are only for the use of the intended recipient and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient, any disclosure, distribution or other use of this e-mail message or attachments is prohibited. If you have received this e-mail message in error, please delete and notify the sender immediately. Thank you.

Re: Castor To Create Java Files From XML/XSD

by sia :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Sure,
The architect on the project feels that the Castor project has more to offer in terms of robustness and also development efforts over JAXB. I believe he is going to use some of the persistance capabilities on this project down the line, so this gets things moving in the right direction.

Hope that makes sense.
Scott





Werner Guttmann <werner.guttmann@...>

07/01/2008 03:45 PM
Please respond to
user@...

To
user@...
cc
Subject
Re: [castor-user] Castor To Create Java Files From XML/XSD





Scott,

one more question ....

Werner

Scott Purcell wrote:
> Hello,
>
> Kind of new with this, so here goes. I have a project that is currently
> using JAXB and our team would like to switch to Castor. The way this works
> is we have a XML document with some XML Schema tags in it that we used
> with JAXB.
Actually, would you be willing to share with is why you are switching
away from JAXB ?

>
> I would like to be able to generate the java files for this using Castor
> and then of course have castor unmarshall the forms at a later time.
That's an out-of-the box feature of Castor in that you will be able to
use the generated Java classes (mainly two Java classes per global XML
schema artefact) to unmarshal from and marshal to your XML document
instances (incl. object-level validation, etc.).

>
> I have searched the docs, and do not see how this is accomplished. I
> worked through the tutorial, and all I see is how to make the XSD while
> marshalling the data, but the team wants to create their own XML and have
> castor create the java from it.
>
> Thanks,
> Scott
>
>
>
> CONFIDENTIALITY NOTICE
> This e-mail message and any attachments are only for the use of the intended recipient and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient, any disclosure, distribution or other use of this e-mail message or attachments is prohibited. If you have received this e-mail message in error, please delete and notify the sender immediately. Thank you.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email






CONFIDENTIALITY NOTICE
This e-mail message and any attachments are only for the use of the intended recipient and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient, any disclosure, distribution or other use of this e-mail message or attachments is prohibited. If you have received this e-mail message in error, please delete and notify the sender immediately. Thank you.

Re: Castor To Create Java Files From XML/XSD

by Werner Guttmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Scott,

have a look at

http://www.castor.org/srcgen-anttask.html

that shows you how to make use of the Ant task (definition) as offered
by the Castor project. This Ant task basically allows you to define how
sources should be generated from an XML schema using Ant as your build tool.

There's a few samples at the bottom of this page, and if there's more
questions, do not hesitate to ping us here.

Regards
Werner

Scott Purcell wrote:

> Thanks Werner for the email.
>
> I discussed this with my teammates, and they would like to use Ant to
> generate the  source.
> And currently it is just one XML Schema (today) but they anticipate many
> XML Schemas down the road. And they would all be disjunct no master per
> sey.
>
> Thanks,
> Scott
>
>
>
>
>
>
> Werner Guttmann <werner.guttmann@...>
> 07/01/2008 03:42 PM
> Please respond to
> user@...
>
>
> To
> user@...
> cc
>
> Subject
> Re: [castor-user] Castor To Create Java Files From XML/XSD
>
>
>
>
>
>
> Scott,
>
> before pointing you to the right places, let me ask you a few questions:
>
> a) How would you want to trigger the code generation ? In other words,
> what build environment are you using ? Ant ? Maven ?
>
> b) Is it just one XML schema, or a set of XML schema files from which
> you want Java code to be generated ? If more than one, is this a
> disjunct set, or is there e.g. a master schema that includes/imports all
> the other XML schemas ?
>
> Regards
> Werner
>
> Scott Purcell wrote:
>> Hello,
>>
>> Kind of new with this, so here goes. I have a project that is currently
>> using JAXB and our team would like to switch to Castor. The way this
> works
>> is we have a XML document with some XML Schema tags in it that we used
>> with JAXB.
>>
>> I would like to be able to generate the java files for this using Castor
>
>> and then of course have castor unmarshall the forms at a later time.
>>
>> I have searched the docs, and do not see how this is accomplished. I
>> worked through the tutorial, and all I see is how to make the XSD while
>> marshalling the data, but the team wants to create their own XML and
> have
>> castor create the java from it.
>>
>> Thanks,
>> Scott
>>
>>
>>
>> CONFIDENTIALITY NOTICE
>> This e-mail message and any attachments are only for the use of the
> intended recipient and may contain information that is privileged,
> confidential or exempt from disclosure under applicable law. If you are
> not the intended recipient, any disclosure, distribution or other use of
> this e-mail message or attachments is prohibited. If you have received
> this e-mail message in error, please delete and notify the sender
> immediately. Thank you.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
>
>
>
>
> CONFIDENTIALITY NOTICE
> This e-mail message and any attachments are only for the use of the intended recipient and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient, any disclosure, distribution or other use of this e-mail message or attachments is prohibited. If you have received this e-mail message in error, please delete and notify the sender immediately. Thank you.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Castor To Create Java Files From XML/XSD

by Werner Guttmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Scott,


Scott Purcell wrote:
> Sure,
> The architect on the project feels that the Castor project has more to
> offer in terms of robustness and also development efforts over JAXB.
:_).

> I
> believe he is going to use some of the persistance capabilities on this
> project down the line, so this gets things moving in the right direction.
Any idea how much time there is between now and 'down the line' ? As a
matter of fact, you will be able to use Castor for both XML data binding
and persistence straight out of the box, but we (and group of students
under my supervision and myself) are currently adding a new feature to
Castor that - given that you have your XML schemas annotated with
JDO-specific information - will allow you to generate descriptor (the
glue code to facilitate binding between Java and XML/persistence)
classes for both XML and JDO side of things. Currently, only XML is
supported.

Regards
Werner

>
> Hope that makes sense.
> Scott
>
>
>
>
>
>
> Werner Guttmann <werner.guttmann@...>
> 07/01/2008 03:45 PM
> Please respond to
> user@...
>
>
> To
> user@...
> cc
>
> Subject
> Re: [castor-user] Castor To Create Java Files From XML/XSD
>
>
>
>
>
>
> Scott,
>
> one more question ....
>
> Werner
>
> Scott Purcell wrote:
>> Hello,
>>
>> Kind of new with this, so here goes. I have a project that is currently
>> using JAXB and our team would like to switch to Castor. The way this
> works
>> is we have a XML document with some XML Schema tags in it that we used
>> with JAXB.
> Actually, would you be willing to share with is why you are switching
> away from JAXB ?
>
>> I would like to be able to generate the java files for this using Castor
>
>> and then of course have castor unmarshall the forms at a later time.
> That's an out-of-the box feature of Castor in that you will be able to
> use the generated Java classes (mainly two Java classes per global XML
> schema artefact) to unmarshal from and marshal to your XML document
> instances (incl. object-level validation, etc.).
>> I have searched the docs, and do not see how this is accomplished. I
>> worked through the tutorial, and all I see is how to make the XSD while
>> marshalling the data, but the team wants to create their own XML and
> have
>> castor create the java from it.
>>
>> Thanks,
>> Scott
>>
>>
>>
>> CONFIDENTIALITY NOTICE
>> This e-mail message and any attachments are only for the use of the
> intended recipient and may contain information that is privileged,
> confidential or exempt from disclosure under applicable law. If you are
> not the intended recipient, any disclosure, distribution or other use of
> this e-mail message or attachments is prohibited. If you have received
> this e-mail message in error, please delete and notify the sender
> immediately. Thank you.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
>
>
>
>
> CONFIDENTIALITY NOTICE
> This e-mail message and any attachments are only for the use of the intended recipient and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient, any disclosure, distribution or other use of this e-mail message or attachments is prohibited. If you have received this e-mail message in error, please delete and notify the sender immediately. Thank you.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email