On Monday 31 July 2006 14:43, NAKAMURA, Hiroshi wrote:
> 0% irb
> irb(main):001:0> require 'xsd/mapping'
> => true
> irb(main):002:0> people = XSD::Mapping.xml2obj(File.read("people.xml"))
> => #<SOAP::Mapping::Object:0x3592020
> {}person=[#<SOAP::Mapping::Object:0x3591ea0 {}name="name1" {}size="1">,
> #<SOAP::Mapping::Object:0x3591684 {}name="name2" {}size="2">,
> #<SOAP::Mapping::Object:0x3590f7c {}name="name3" {}size="3">]>
> irb(main):003:0> people.person.each { |person| p person }
> #<SOAP::Mapping::Object:0x3591ea0 {}name="name1" {}size="1">
> #<SOAP::Mapping::Object:0x3591684 {}name="name2" {}size="2">
> #<SOAP::Mapping::Object:0x3590f7c {}name="name3" {}size="3">
> => [#<SOAP::Mapping::Object:0x3591ea0 {}name="name1" {}size="1">,
> #<SOAP::Mapping::Object:0x3591684 {}name="name2" {}size="2">,
> #<SOAP::Mapping::Object:0x3590f7c {}name="name3" {}size="3">]
> irb(main):004:0> people.person[2].name
> => "name3"
> irb(main):005:0> people.person.name
> NoMethodError: undefined method `name' for #<Array:0x6b22108>
>         from (irb):5
> irb(main):006:0>
>
> Almost.
>
> Regards,
> // NaHi
That's really nice, I'd looked over that in the standard library. I've used 
Roxml with success to achieve the same effect, but it requires more work.

Alex