mischov / meeseeks

An Elixir library for parsing and extracting data from HTML and XML with CSS or XPath selectors.
MIT License
316 stars 23 forks source link

no function clause matching in Meeseeks.Accumulator.One.add/3 #123

Open fireindark707 opened 1 year ago

fireindark707 commented 1 year ago

I'm using some xpath like "//center[h2[@class='chapter' and contains(text()[preceding-sibling::br],'some string')]]/following-sibling::h3[@class='news-title']"

And here is the error:

** (FunctionClauseError) no function clause matching in Meeseeks.Accumulator.One.add/3    

    The following arguments were given to Meeseeks.Accumulator.One.add/3:

        # 1
        %Meeseeks.Accumulator.One{
          value: #Meeseeks.Result<{ <h3 class="news-title">some string</h3> }>
        }

        # 2
        #Meeseeks.Document<{...}>

        # 3
        566

    Attempted function clauses (showing 1 out of 1):

        def add(%Meeseeks.Accumulator.One{value: nil} = acc, document, id)

I'm not sure what happened, but if I removed [@class='news-title'] at the end, meeseeks runs normally.

mischov commented 1 year ago

Can you provide an html sample that can be used to re-create the issue?

fireindark707 commented 1 year ago

Can you provide an html sample that can be used to re-create the issue?

Yes, of course.

<center><h2 class="chapter">021<br>some string</h2></center>
<h3 class="news-title">some news title</h3>