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)

static bool getHtmlTagParameters_debug;

// tag is CNC of the whole container tag
static S xml_getArg(L<S> tag, S name) {
  ret xml_getArg(get(tag, 1), name);
}

// s is just the tag from < to >
static S xml_getArg(S s, S name) {
  int i = indexOf(s, ' ');
  if (i < 0) null;
  while true {
    while (" \t".indexOf(charAt(s, i)) >= 0) ++i;
    int j = indexOfAny(s, i, " \t>/");
    if (j <= i) null;
    int eq = indexOf(s, '=', i);
    S key = eq < 0 ? substring(s, i, j) : substring(s, i, eq);
    if (eqic(key, name))
      ret eq < 0 ? key : htmlUnquote(substring(s, eq+1, j));
    i = j;
  }
}

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: 493 / 521
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)