# Castor-like Package for Ruby

**URL:** <https://www.ruby-forum.com/t/castor-like-package-for-ruby/116267>\
**Category:** Ruby\
**Created:** [October 3, 2007, 11:42pm UTC](https://www.ruby-forum.com/t/castor-like-package-for-ruby/116267 "2007-10-03T23:42:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![roxah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/54ee81/32.png) [@roxah](https://www.ruby-forum.com/u/roxah)\
**Post date:** [October 3, 2007, 11:42pm UTC](https://www.ruby-forum.com/t/castor-like-package-for-ruby/116267/1 "2007-10-03T23:42:58Z")

</div>

Hello all,

I come from a Java background, where lately I’ve been using Castor to  
generate Java objects from an XML schema and marshal/unmarshal XML  
documents using the generated Java objects.

Is there a Ruby package that will allow me to do the same thing? I’ve  
figured out how to use WSDL::XMLSchema::XSD2Ruby to create Ruby objects  
from an XML schema, but it does not create the marshal/unmarshal methods  
that allow me to load the objects with data from XML files.

Any suggestions?

Thanks! – BTR

---

<div class="post-metadata">

**Author:** ![roxah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/54ee81/32.png) [@roxah](https://www.ruby-forum.com/u/roxah)\
**Post date:** [October 4, 2007, 9:46am UTC](https://www.ruby-forum.com/t/castor-like-package-for-ruby/116267/2 "2007-10-04T09:46:17Z")

</div>

On Thu, 4 Oct 2007, Bryan R. wrote:

> I come from a Java background, where lately I’ve been using Castor to  
> generate Java objects from an XML schema and marshal/unmarshal XML  
> documents using the generated Java objects.
> 
> Is there a Ruby package that will allow me to do the same thing? I’ve  
> figured out how to use WSDL::XMLSchema::XSD2Ruby to create Ruby objects  
> from an XML schema, but it does not create the marshal/unmarshal methods  
> that allow me to load the objects with data from XML files.

soap4r has a tool wsdl2ruby that takes a wsdl definition and creates  
classes that un/marshall to/from the XML data that comes  
accross the wire when you make SOAP calls. Which would be very similar  
to what you need. Thus you might want to have a look at wsdl2ruby.

I hope I’ve interpreted your question correctly…  
\*t

–

---

<div class="post-metadata">

**Author:** ![roxah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/54ee81/32.png) [@roxah](https://www.ruby-forum.com/u/roxah)\
**Post date:** [October 5, 2007, 3:06am UTC](https://www.ruby-forum.com/t/castor-like-package-for-ruby/116267/3 "2007-10-05T03:06:48Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Hi,

Bryan R. wrote:

> Thanks for the response Tom. I’ll take a look at the WSDL stuff. As a  
> side note, the xsd2ruby code I’m using actually belongs to the WSDL  
> module…

soap4r-1.5.8 includes xsd2ruby.rb command line script for that purpose.  
The ruby/1.8.x contains soap4r-1.5.5.

The release announce posted on this list;  
[http://groups.google.com/group/comp.lang.ruby/msg/28ba977ece309ebd](http://groups.google.com/group/comp.lang.ruby/msg/28ba977ece309ebd)  
contains an usage example of XML ↔ Ruby mapping of Yahoo Local Search.

Regards,  
// NaHi  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.5 (Cygwin)

iQEVAwUBRwWNxR9L2jg5EEGlAQIISggAgaNLsUeZO22X6mHc7vsIGfqq1tYv39mQ  
xWBWXojTdBXdMBfrjbN7hoAvFwxjp2u6MzlT6dU7JEqeLzNKcPtScPoTYc6nrbJl  
thDkbDkin0w0URY/JNcFJF8OBo289iGviscAHagODN9bRGw2LDEWyLYPD5r37K5M  
wghUhBGkc6uuIr+L4HfA7WYG9zoWQntU2Feod+jmER+vpchjHleBLwsj8OWyxf51  
v4D9sB4ejihPHiphjfVl/NdBMAWN+bybeTGgqYWBvIXvMuPzdVMHrZ83e0TRHLkc  
Iyf5LjiXpHvFitjVMa3G57cgdo4PgsVsKPFXoj3MSOce0ClPlazfEw==  
=sDth  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![roxah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/54ee81/32.png) [@roxah](https://www.ruby-forum.com/u/roxah)\
**Post date:** [October 4, 2007, 8:04pm UTC](https://www.ruby-forum.com/t/castor-like-package-for-ruby/116267/4 "2007-10-04T20:04:28Z")

</div>

Thanks for the response Tom. I’ll take a look at the WSDL stuff. As a  
side note, the xsd2ruby code I’m using actually belongs to the WSDL  
module…

Bryan

Tomas P.'s Mailing L. wrote:

> On Thu, 4 Oct 2007, Bryan R. wrote:
> 
> > I come from a Java background, where lately I’ve been using Castor to  
> > generate Java objects from an XML schema and marshal/unmarshal XML  
> > documents using the generated Java objects.
> > 
> > Is there a Ruby package that will allow me to do the same thing? I’ve  
> > figured out how to use WSDL::XMLSchema::XSD2Ruby to create Ruby objects  
> > from an XML schema, but it does not create the marshal/unmarshal methods  
> > that allow me to load the objects with data from XML files.
> 
> soap4r has a tool wsdl2ruby that takes a wsdl definition and creates  
> classes that un/marshall to/from the XML data that comes  
> accross the wire when you make SOAP calls. Which would be very similar  
> to what you need. Thus you might want to have a look at wsdl2ruby.
> 
> I hope I’ve interpreted your question correctly…  
> \*t
> 
> –
