Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to get the text in a element line by line #384

Closed
R0ronoaZoro opened this issue Jul 2, 2021 · 1 comment
Closed

Is it possible to get the text in a element line by line #384

R0ronoaZoro opened this issue Jul 2, 2021 · 1 comment

Comments

@R0ronoaZoro
Copy link

R0ronoaZoro commented Jul 2, 2021

Let's say there's a html like this,

  <td>
      Line 1
      <br>
      Line 2
      <br>
  </br>

I managed to get the text inside the <br> tags. Is it possible to get each lines separately line by line ?

@mna
Copy link
Member

mna commented Jul 2, 2021

Hello,

There is no way to do this directly, but you can take a look at my comment on another similar issue, it should work in your case too: #287 (comment) (i.e. get the contents of the <td> and iterate over the nodes, finding the #text nodes).

Hope this helps,
Martin

@mna mna closed this as completed Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants