Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

14
LINES

< > BotCompany Repo | #1030276 // findHTMLTagWithClassDeep - HTML parsing, filter by class

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4706L/31K).

1  
// tok must come from htmlTok
2  
// returns all container tags found (including content) as CNC
3  
// honors nested tags correctly
4  
static LLS mapMethodLike findHTMLTagWithClassDeep(S className, LS tok) {
5  
  new LLS l;
6  
  int i = 1;
7  
  for (i = 1; i < l(tok); i += 2) {
8  
    if (cic(splitAtSpace_trim(tagParam(tok.get(i), "class")), className)) {
9  
      int j = findClosingTag(tok, i);
10  
      l.add(subList(tok, i-1, j+2));
11  
    }
12  
  }
13  
  ret l;
14  
}

Author comment

Began life as a copy of #1008450

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030276
Snippet name: findHTMLTagWithClassDeep - HTML parsing, filter by class
Eternal ID of this version: #1030276/5
Text MD5: d4383acd0a71d086d606ea31bc1d524e
Transpilation MD5: 2a3f5e6176dd80810225d1dd6afcb669
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-25 14:20:39
Source code size: 444 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 129 / 193
Version history: 4 change(s)
Referenced in: [show references]