Skip to content

Filtering via xpath breaks when tag != class name #9

@kjf

Description

@kjf

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions