You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the most tedious part of HappyMapper is attempting to model the XML data as a HappyMapper class. After that it becomes a fairly enjoyable experience. What if we had a method that could generate for you the source code from a specified XML input.
class Address
include HappyMapper
has_one :street, String
has_one :postcode, String
has_one :housenumber, String
has_one :city, String
has_one :country, 'Country'
end
class Country
include HappyMapper
content :content, String
attribute :code, String
end
Perhaps this would be most useful as a command-line application:
$ happymapper address.xml > address.rb
The text was updated successfully, but these errors were encountered:
This would be a nice generator to get you started. Perhaps a generator based on XSD input could even make it possible to change the String in to the correct type.
A generator that works for specific XSD's is not that hard (I've written one using Nokogiri and xpath expressions, with some inspiration from Wasabi), estimating it would take me less time than writing the classes by hand), but if you want to be able to handle any XSD, I think it becomes a pretty large task.
A parser based on XML examples may be more useful for most people.
HappyMapper model generator
Currently the most tedious part of HappyMapper is attempting to model the XML data as a HappyMapper class. After that it becomes a fairly enjoyable experience. What if we had a method that could generate for you the source code from a specified XML input.
Within code you would write:
This would output:
Perhaps this would be most useful as a command-line application:
$ happymapper address.xml > address.rb
The text was updated successfully, but these errors were encountered: