• happymapper cannot get element

    From Sayth Renshaw@21:1/5 to All on Sat Feb 11 04:34:33 2017
    Hi

    I am having a hard time working with the examples on the happymapper fork site https://github.com/dam5s/happymapper.

    require 'happymapper'

    My expected output
    sayth@sayth-E6410 ~/race (master●)$ ruby read_race.rb [ruby-2.4.0p0]
    de
    Germany
    23

    My current output
    sayth@sayth-E6410 ~/race (master●)$ ruby read_race.rb [ruby-2.4.0p0]
    de
    Germany

    It's just missing I have tried many version however cannot get 23 to spit out.




    xml_doc = <<EOF
    <address location='home'>
    <street>Milchstrasse</street>
    <street>Another Street</street>
    <housenumber>23</housenumber>
    <postcode>26131</postcode>
    <city>Oldenburg</city>
    <country code="de">Germany</country>
    </address>
    EOF

    class Country
    include HappyMapper

    tag 'address'
    content :housenumber, Integer

    # element :name, Integer

    tag 'country'

    attribute :code, String
    content :name, String

    end

    outputs = Country.parse(xml_doc)
    outputs.each do |output|
    puts output.code
    puts output.name
    puts output.housenumber
    end

    Any ideas?

    Cheers

    Sayth

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)