B4J Question Help with jSoup

Ilya G.

Active Member
Licensed User
Longtime User
Please help to parse "titles" from this html:
HTML:
<tr id="grid_row_0" style="height: auto" class=" cdata data_row  ">
 <td class="col_checkbox with_corner"> <p class="corner_wrapper"> <input type="checkbox" class="gridItemCheckbox" value="6b2b2048-d849-4d77-8af9-527c5d8501c0:cf60d4b5-3928-4136-b6f7-5e91f38101b3"> </p> </td>
 <td class="document_extra_info"> <i class="fa fa-paperclip" aria-hidden="true"></i> </td>
 <td class="document_extra_info"> </td>
 <td class="grid_row_single_line" onclick="if(!$(this).data('lockedAt') || +new Date() - $(this).data('lockedAt') > 400) { msf.page.viewNode('/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments');  } $(this).data('lockedAt', +new Date()); return false;"> <a class="lmk" href="/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments" onclick="return false;" title="ПР-17"> ПР-17 </a> </td>
 <td class="grid_row_single_line" onclick="if(!$(this).data('lockedAt') || +new Date() - $(this).data('lockedAt') > 400) { msf.page.viewNode('/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments');  } $(this).data('lockedAt', +new Date()); return false;"> <a class="lmk" href="/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments" onclick="return false;" title="11.04.2020"> 11.04.2020 </a> </td>
 <td class="grid_row_single_line" onclick="if(!$(this).data('lockedAt') || +new Date() - $(this).data('lockedAt') > 400) { msf.page.viewNode('/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments');  } $(this).data('lockedAt', +new Date()); return false;"> <a class="lmk" href="/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments" onclick="return false;" title="Касательно разработки сайта </a> </td>
 <td class="grid_row_single_line" onclick="if(!$(this).data('lockedAt') || +new Date() - $(this).data('lockedAt') > 400) { msf.page.viewNode('/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments');  } $(this).data('lockedAt', +new Date()); return false;"> <a class="lmk" href="/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments" onclick="return false;" title="Искандыров А.М. (Начальник отдела)"> Искандыров А.М. (Начальник отдела) </a> </td>
 <td class="grid_row_single_line" onclick="if(!$(this).data('lockedAt') || +new Date() - $(this).data('lockedAt') > 400) { msf.page.viewNode('/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments');  } $(this).data('lockedAt', +new Date()); return false;"> <a class="lmk" href="/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments" onclick="return false;" title=""> </a> </td>
 <td class="grid_row_single_line" onclick="if(!$(this).data('lockedAt') || +new Date() - $(this).data('lockedAt') > 400) { msf.page.viewNode('/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments');  } $(this).data('lockedAt', +new Date()); return false;"> <a class="lmk" href="/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments" onclick="return false;" title=""> </a> </td>
 <td class="grid_row_single_line" onclick="if(!$(this).data('lockedAt') || +new Date() - $(this).data('lockedAt') > 400) { msf.page.viewNode('/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments');  } $(this).data('lockedAt', +new Date()); return false;"> <a class="lmk" href="/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments" onclick="return false;" title="Проект Исходящего документа"> Проект Исходящего документа </a> </td>
</tr>

I have been try jSoup.selectorElementAttr(s, "td[class*=grid_row_single_line]", "title"). It's working on full html, but doesn't work on this fragment.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4X:
Dim s As String = $"<tr id="grid_row_0" style="height: auto" class=" cdata data_row  ">
<td class="col_checkbox with_corner"> <p class="corner_wrapper"> <input type="checkbox" class="gridItemCheckbox" value="6b2b2048-d849-4d77-8af9-527c5d8501c0:cf60d4b5-3928-4136-b6f7-5e91f38101b3"> </p> </td>
<td class="document_extra_info"> <i class="fa fa-paperclip" aria-hidden="true"></i> </td>
<td class="document_extra_info"> </td>
<td class="grid_row_single_line" onclick="if(!$(this).data('lockedAt') || +new Date() - $(this).data('lockedAt') > 400) { msf.page.viewNode('/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments');  } $(this).data('lockedAt', +new Date()); return false;"> <a class="lmk" href="/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments" onclick="return false;" title="ПР-17"> ПР-17 </a> </td>
<td class="grid_row_single_line" onclick="if(!$(this).data('lockedAt') || +new Date() - $(this).data('lockedAt') > 400) { msf.page.viewNode('/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments');  } $(this).data('lockedAt', +new Date()); return false;"> <a class="lmk" href="/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments" onclick="return false;" title="11.04.2020"> 11.04.2020 </a> </td>
<td class="grid_row_single_line" onclick="if(!$(this).data('lockedAt') || +new Date() - $(this).data('lockedAt') > 400) { msf.page.viewNode('/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments');  } $(this).data('lockedAt', +new Date()); return false;"> <a class="lmk" href="/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments" onclick="return false;" title="Касательно разработки сайта </a> </td>
<td class="grid_row_single_line" onclick="if(!$(this).data('lockedAt') || +new Date() - $(this).data('lockedAt') > 400) { msf.page.viewNode('/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments');  } $(this).data('lockedAt', +new Date()); return false;"> <a class="lmk" href="/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments" onclick="return false;" title="Искандыров А.М. (Начальник отдела)"> Искандыров А.М. (Начальник отдела) </a> </td>
<td class="grid_row_single_line" onclick="if(!$(this).data('lockedAt') || +new Date() - $(this).data('lockedAt') > 400) { msf.page.viewNode('/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments');  } $(this).data('lockedAt', +new Date()); return false;"> <a class="lmk" href="/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments" onclick="return false;" title=""> </a> </td>
<td class="grid_row_single_line" onclick="if(!$(this).data('lockedAt') || +new Date() - $(this).data('lockedAt') > 400) { msf.page.viewNode('/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments');  } $(this).data('lockedAt', +new Date()); return false;"> <a class="lmk" href="/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments" onclick="return false;" title=""> </a> </td>
<td class="grid_row_single_line" onclick="if(!$(this).data('lockedAt') || +new Date() - $(this).data('lockedAt') > 400) { msf.page.viewNode('/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments');  } $(this).data('lockedAt', +new Date()); return false;"> <a class="lmk" href="/workflow/document/view/6b2b2048-d849-4d77-8af9-527c5d8501c0/cf60d4b5-3928-4136-b6f7-5e91f38101b3?mydocuments" onclick="return false;" title="Проект Исходящего документа"> Проект Исходящего документа </a> </td>
</tr>"$
Dim m As Matcher = Regex.Matcher($"title=\"([^>]*)\">"$, s)
Do While m.Find
    Log(m.Group(1))
Loop
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0
Top