From: Justin Bailey Date: 2006-02-24T02:48:03+09:00 Subject: Re: Creating Ruby Classes from XSD? ------=_Part_9371_3762546.1140716866738 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Well, what it really makes easy is the import of a given XML document into code. In .NET land, the XSD describes the format for a set of XML documents= . The class generated is then used to import those XML documents into a structure that it's to work with in code than the raw DOM would be. On 2/23/06, Logan Capaldo wrote: > > > On Feb 23, 2006, at 12:12 PM, Justin Bailey wrote: > > > .NET ships with a tool that will generate classes directly from an XML > > schema (XSD) file. Does the Ruby standard library have anything > > similar? > > It's a great tool on the .NET side, and I bet Ruby could do it even > > better, > > if not. > > Ok, I'm going to be honest and say first I've never had occasion to > use this tool. But I'm wondering what exactly is the point? Ruby's > syntax is much less verbose than XML. > Why would you want to type this: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > When you can do one of these: > class Shipto < Struct.new(:name, :address, :city, :country) > end > > class Item < Struct.new(:orderid, :title, :note, :quantity, :price) > end > > class Shipment < Struct.new(:shipto, :item) > end > > shipments =3D [] > > I may have mangled some of the XSD, I'm admitedly not familiar with > it, but generating classes froma schema seems rife with problems > > > > ------=_Part_9371_3762546.1140716866738--