I''ve been unserializing XML in PHP with the XML_Serializer class, and I''m wondering if anyone knows of such a class for Ruby. Nothing fancy, just perhaps a simple way of converting arbitrary XML to a Ruby object. Maybe this has been implemented somewhere already? Thanks, Raymond
On 8/22/05, Raymond Brigleb <ray-THGPwszTed5CpjqP0VxSwUEOCMrvLtNR@public.gmane.org> wrote:> I''ve been unserializing XML in PHP with the XML_Serializer class, and > I''m wondering if anyone knows of such a class for Ruby. Nothing > fancy, just perhaps a simple way of converting arbitrary XML to a > Ruby object. Maybe this has been implemented somewhere already?Check out XMLSimple (which is bundled with Rails 0.13+) http://www.maik-schmidt.de/xml-simple.html
On 8/23/05, Josh Knowles <joshknowles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Check out XMLSimple (which is bundled with Rails 0.13+) > http://www.maik-schmidt.de/xml-simple.htmlIf you don''t like hash semantics, and prefer to work with objects, try this little wrapper around REXML (attached). Usage: node.name.subname.subsubname[:attribute] # Attribute node.name.subname.value # CDATA node.name.subname # Array of elements named subname The included test case should provide enough samples of how it works (a lot of ideas from an ONlamp article about E4X). Leon _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 8/22/05, leon breedt <bitserf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If you don''t like hash semantics, and prefer to work with objects, try > this little wrapper around REXML (attached).That is pretty sweet Leon, have you submitted that as a patch to REXML or as an addition to Rails core?
On 8/23/05, Josh Knowles <joshknowles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> That is pretty sweet Leon, have you submitted that as a patch to REXML > or as an addition to Rails core?Been meaning to create a patch a.l.a. the XMLSimple stuff, I''ll add that to the stack :) Leon
I came across an excellent little ruby library on rubyforge called XML-Mapping. You essentially set up small APIs for your XML that converts items in your XML file into Ruby objects. Take a look here: http://xml-mapping.rubyforge.org/ Cheers Luke _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails