happymapper icon indicating copy to clipboard operation
happymapper copied to clipboard

Filtering via xpath breaks when tag != class name

Open kjf opened this issue 12 years ago • 1 comments

If I change the xpath_spec.rb to this:

class TestBaby
  include HappyMapper

  tag 'baby'
  has_one :name, String
end

class Item
  include HappyMapper

  tag 'item'
  namespace 'amazing'

  element :title, String
  attribute :link, String, :xpath => 'amazing:link/@href'
  has_one :different_link, String, :xpath => 'different:link/@href'
  element :detail, String, :xpath => 'amazing:subitem/amazing:detail'
  has_many :more_details_text, String, :xpath => 'amazing:subitem/amazing:more'
  has_many :more_details, String, :xpath => 'amazing:subitem/amazing:more/@first|amazing:subitem/amazing:more/@alternative'
  has_many :more_details_alternative, String, :xpath => 'amazing:subitem/amazing:more/@*'

  has_one :test_baby, TestBaby, :namespace => 'amazing'

end


Then things start to break down. It seems that xpath filtering does not like it when we the class name does not match the tag name.

kjf avatar Jun 22 '12 11:06 kjf

I'll have to take a look at this further. By breakdown means, it all blows up or fails to match things?

burtlo avatar Jul 06 '12 22:07 burtlo