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

22
LINES

< > BotCompany Repo | #1009182 // xml_getArg - get parameter of XML tag

JavaX fragment (include)

1  
static bool getHtmlTagParameters_debug;
2  
3  
// tag is CNC of the whole container tag
4  
static S xml_getArg(L<S> tag, S name) {
5  
  ret xml_getArg(get(tag, 1), name);
6  
}
7  
8  
// s is just the tag from < to >
9  
static S xml_getArg(S s, S name) {
10  
  int i = indexOf(s, ' ');
11  
  if (i < 0) null;
12  
  while true {
13  
    while (" \t".indexOf(charAt(s, i)) >= 0) ++i;
14  
    int j = indexOfAny(s, i, " \t>/");
15  
    if (j <= i) null;
16  
    int eq = indexOf(s, '=', i);
17  
    S key = eq < 0 ? substring(s, i, j) : substring(s, i, eq);
18  
    if (eqic(key, name))
19  
      ret eq < 0 ? key : htmlUnquote(substring(s, eq+1, j));
20  
    i = j;
21  
  }
22  
}

Author comment

Began life as a copy of #1005220

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009182
Snippet name: xml_getArg - get parameter of XML tag
Eternal ID of this version: #1009182/5
Text MD5: 7d9e42ed5e28b0cab946abe88984fa88
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-07-12 22:03:38
Source code size: 621 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 384 / 413
Version history: 4 change(s)
Referenced in: [show references]