001package Torello.HTML; 002 003import java.util.Vector; 004import java.util.Properties; 005 006import Torello.Java.LV; 007import Torello.Java.StrFilter; 008import Torello.Java.Additional.Ret2; 009import Torello.Java.Function.IntTFunction; 010import Torello.JavaDoc.LinkJavaSource; 011import Torello.JavaDoc.IntoHTMLTable; 012 013import static Torello.JavaDoc.IntoHTMLTable.Background.BlueDither; 014import static Torello.JavaDoc.IntoHTMLTable.Background.GreenDither; 015import static Torello.JavaDoc.Entity.METHOD; 016 017/** 018 * Utilities for getting, setting and removing attributes from the {@link TagNode} elements in a 019 * Web-Page {@code Vector}. 020 * 021 * <BR /><BR /><EMBED CLASS='external-html' DATA-FILE-ID=ATTRIBUTES> 022 * @see AUM 023 */ 024@Torello.JavaDoc.StaticFunctional 025public class Attributes 026{ 027 private Attributes() { } 028 029 030 // ******************************************************************************************** 031 // ******************************************************************************************** 032 // Update Attributes 033 // ******************************************************************************************** 034 // ******************************************************************************************** 035 036 037 /** 038 * <BR>Passes: Simple Update Lambda that <B>always</B> assigns {@code 'itValue'} to the 039 * Attribute 040 * <BR>Iterates: The entire {@code html}-page, Passes 0 & -1 to sPos & ePos 041 * <BR>See Documentation: {@link #update(Vector, AUM, int, int, String, IntTFunction, SD)} 042 */ 043 @IntoHTMLTable( 044 background=BlueDither, 045 title="Update all TagNode's which have an Attribute named " + 046 "<CODE>'innerTag'</CODE> " + 047 "using <CODE>'mode'</CODE> & <CODE>'itValue'</CODE>" 048 ) 049 @Torello.JavaDoc.LinkJavaSource(handle="Update", name="update", paramCount=7) 050 public static int[] update 051 (Vector<? super TagNode> html, 052 AUM mode, 053 String innerTag, 054 String itValue, 055 SD quote) 056 { 057 return Update.update 058 (html, mode, 0, -1, innerTag, (int index, TagNode tn) -> itValue, quote); 059 } 060 061 /** 062 * <BR>Receives: {@code DotPair} 063 * <BR>Passes: Simple Update Lambda that <B>always</B> assigns {@code 'itValue'} to the 064 * Attribute 065 * <BR>Iterates: The {@code html}-page from {@code dp.start} (inclusive) to {@code dp.end} 066 * (also inclusive) 067 * <BR>See Documentation: {@link #update(Vector, AUM, int, int, String, IntTFunction, SD)} 068 */ 069 @IntoHTMLTable( 070 background=GreenDither, 071 title="Update all TagNode's which have an Attribute named " + 072 "<CODE>'innerTag'</CODE> " + 073 "using <CODE>'mode'</CODE> & <CODE>'itValue'</CODE>" 074 ) 075 @LinkJavaSource(handle="Update", name="update", paramCount=7) 076 public static int[] update( 077 Vector<? super TagNode> html, 078 AUM mode, 079 DotPair dp, 080 String innerTag, 081 String itValue, 082 SD quote 083 ) 084 { 085 return Update.update( 086 html, mode, dp.start, dp.end + 1, innerTag, 087 (int index, TagNode tn) -> itValue, quote 088 ); 089 } 090 091 /** 092 * <BR>Receives: An Attribute-Update Lambda-Function {@code 'newITValueStrGetter'} 093 * <BR>Iterates: The entire {@code html}-page, Passes 0 & -1 to sPos & ePos 094 * <BR>See Documentation: {@link #update(Vector, AUM, int, int, String, IntTFunction, SD)} 095 */ 096 @IntoHTMLTable( 097 background=BlueDither, 098 title="Update all TagNode's which have an Attribute named " + 099 "<CODE>'innerTag'</CODE> " + 100 "using <CODE>'mode'</CODE> & <CODE>'newITValueStrGetter'</CODE>" 101 ) 102 @LinkJavaSource(handle="Update", name="update", paramCount=7) 103 public static int[] update( 104 Vector<? super TagNode> html, 105 AUM mode, 106 String innerTag, 107 IntTFunction<TagNode, String> newITValueStrGetter, 108 SD quote 109 ) 110 { return Update.update(html, mode, 0, -1, innerTag, newITValueStrGetter, quote); } 111 112 /** 113 * <BR>Receives: {@code DotPair} 114 * <BR>And-Receives: An Attribute-Update Lambda-Function {@code 'newITValueStrGetter'} 115 * <BR>Iterates: The {@code html}-page from {@code dp.start} (inclusive) to {@code dp.end} 116 * (also inclusive) 117 * <BR>See Documentation: {@link #update(Vector, AUM, int, int, String, IntTFunction, SD)} 118 */ 119 @IntoHTMLTable( 120 background=GreenDither, 121 title="Update all TagNode's which have an Attribute named " + 122 "<CODE>'innerTag'</CODE> " + 123 "using <CODE>'mode'</CODE> & <CODE>'newITValueStrGetter'</CODE>" 124 ) 125 @LinkJavaSource(handle="Update", name="update", paramCount=7) 126 public static int[] update( 127 Vector<? super TagNode> html, 128 AUM mode, 129 DotPair dp, 130 String innerTag, 131 IntTFunction<TagNode, String> newITValueStrGetter, 132 SD quote 133 ) 134 { 135 return Update.update 136 (html, mode, dp.start, dp.end + 1, innerTag, newITValueStrGetter, quote); 137 } 138 139 /** 140 * <BR>Receives: HTML-{@code Vector} starting & ending indices 141 * ({@code sPos} and {@code ePos}). 142 * <BR>Passes: Simple Update Lambda that <B>always</B> assigns {@code 'itValue'} to the 143 * Attribute 144 * <BR>Iterates: The {@code html}-page from {@code sPos} (inclusive) to {@code ePos} 145 * (exclusive) 146 * <BR>See Documentation: {@link #update(Vector, AUM, int, int, String, IntTFunction, SD)} 147 */ 148 @IntoHTMLTable( 149 background=BlueDither, 150 title="Update all TagNode's which have an Attribute named " + 151 "<CODE>'innerTag'</CODE> " + 152 "using <CODE>'mode'</CODE> & <CODE>'itValue'</CODE>" 153 ) 154 @LinkJavaSource(handle="Update", name="update", paramCount=7) 155 public static int[] update( 156 Vector<? super TagNode> html, 157 AUM mode, 158 int sPos, 159 int ePos, 160 String innerTag, 161 String itValue, 162 SD quote 163 ) 164 { 165 return Update.update 166 (html, mode, sPos, ePos, innerTag, (int index, TagNode tn) -> itValue, quote); 167 } 168 169 /** 170 * Will update any HTML {@code TagNode's} present in the vector-parameter {@code 'html'} 171 * according to passed <B>{@code AUM}</B> mode and the {@code 'innerTag'} parameter. 172 * 173 * <EMBED CLASS='external-html' DATA-PROC_TYPE=update DATA-FILE-ID=ATTR_RESTRICT_SE_POS> 174 * 175 * @param html <EMBED CLASS='external-html' DATA-FILE-ID=HTMLVECSUP> 176 * @param mode <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_MODE_PARAM> 177 * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSVEC> 178 * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSVEC> 179 * 180 * @param innerTag This is the <B STYLE="color: red;">name</B> of the HTML attribute that needs 181 * to be changed, added, or removed. 182 * 183 * @param newITValueStrGetter <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_NEW_ITSTR_FUNC> 184 * 185 * @param quote <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_QUOTE_PARAM> 186 * 187 * @return This method shall return an integer-{@code array} index-list whose values identify 188 * which HTML {@code Vector} Elements were changed as a result of this method invocation. 189 * 190 * <BR /><BR /><B>NOTE:</B> One minor subtlety, there could be cases where a new HTML Element 191 * {@code 'TagNode'} reference / object were instantiated or 'created,' even though the actual 192 * {@code String} that comprised the {@code HTMLNode} itself were identical to the original 193 * {@code HTMLNode.str String}. In the {@code 'AUM'} enumerated-type, when {@code AUM.Set} 194 * is invoked, the original {@code String} data for an attribute is always clobbered, even in 195 * cases where an identical version of the {@code String} is replaced or substituted. 196 * 197 * @throws QuotesException <EMBED CLASS='external-html' DATA-FILE-ID=QEX> 198 * @throws InnerTagKeyException <EMBED CLASS='external-html' DATA-FILE-ID=ITKEYEX> 199 * @throws IndexOutOfBoundsException <EMBED CLASS='external-html' DATA-FILE-ID=VIOOBEX> 200 * 201 * @see AUM#update(TagNode, String, String, SD) 202 * @see LV 203 * @see TagNode#isTagNode() 204 * @see TagNode#isClosing 205 */ 206 @LinkJavaSource(handle="Update", name="update", paramCount=7) 207 public static int[] update( 208 Vector<? super TagNode> html, 209 AUM mode, 210 int sPos, 211 int ePos, 212 String innerTag, 213 IntTFunction<TagNode, String> newITValueStrGetter, 214 SD quote 215 ) 216 { return Update.update(html, mode, sPos, ePos, innerTag, newITValueStrGetter, quote); } 217 218 /** 219 * <BR>Receives: An {@code int[]}-Array which identifes which nodes in the {@code Vector} to 220 * update. 221 * <BR>Passes: Simple Update Lambda that <B>always</B> assigns {@code 'itValue'} to the 222 * Attribute 223 * <BR>Iterates: All {@code Vector}-indices pointed to by the values in {@code 'posArr'} 224 * <BR>See Documentation: {@link #update(Vector, AUM, int, int, String, IntTFunction, SD)} 225 */ 226 @IntoHTMLTable( 227 background=GreenDither, 228 title="Update all TagNode's which have an Attribute named " + 229 "<CODE>'innerTag'</CODE> " + 230 "using <CODE>'mode'</CODE> & <CODE>'itValue'</CODE>" 231 ) 232 @LinkJavaSource(handle="Update", name="update", paramCount=6) 233 // 'posArr ==> 6 parameters' 234 public static int[] update( 235 Vector<? super TagNode> html, 236 AUM mode, 237 int[] posArr, 238 String innerTag, 239 String itValue, 240 SD quote 241 ) 242 { 243 return Update.update 244 (html, mode, posArr, innerTag, (int index, TagNode tn) -> itValue, quote); 245 } 246 247 /** 248 * Will update any HTML {@code TagNode's} present in the vector-parameter {@code 'html'} 249 * according to a passed <B>{@code 'AUM'}</B> mode and the {@code 'innerTag'} parameter. 250 * 251 * <EMBED CLASS='external-html' DATA-PROC_TYPE=update DATA-FILE-ID=ATTR_RESTRICT_POSARR> 252 * 253 * @param html <EMBED CLASS='external-html' DATA-FILE-ID=HTMLVECSUP> 254 * @param mode <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_MODE_PARAM> 255 * @param posArr <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_POS_ARR_PARAM> 256 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_UPDATE_AUM_EXAMPLE> 257 * 258 * @param innerTag This is the <B STYLE="color: red;">name</B> of the HMTL attribute that needs 259 * to be changed, added, or removed. 260 * 261 * @param newITValueStrGetter <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_NEW_ITSTR_FUNC> 262 * 263 * @param quote <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_QUOTE_PARAM> 264 * 265 * @return This method shall return an integer-{@code array} index-list whose values identify 266 * which HTML {@code Vector} Elements were changed as a result of this method invokation. 267 * 268 * <BR /><BR /><B>NOTE:</B> One minor subtlety, there could be cases where a new HTML Element 269 * {@code 'TagNode'} reference / object were instantiated or 'created,' even though the actual 270 * {@code String} that comprised the {@code HTMLNode} itself were identical to the original 271 * {@code HTMLNode.str String}. In the {@code 'AUM'} enumerated-type, when {@code AUM.Set} 272 * is invoked, the original {@code String} data for an attribute is always clobbered, even in 273 * cases where an identical version of the {@code String} is replaced or substituted. 274 * 275 * @throws QuotesException <EMBED CLASS='external-html' DATA-FILE-ID=QEX> 276 * @throws InnerTagKeyException <EMBED CLASS='external-html' DATA-FILE-ID=ITKEYEX> 277 * @throws TagNodeExpectedException <EMBED CLASS='external-html' DATA-FILE-ID=TNE_EX> 278 * 279 * @throws OpeningTagNodeExpectedException 280 * <EMBED CLASS='external-html' DATA-FILE-ID=OPEN_TNE_EX> 281 * @throws ArrayIndexOutOfBoundsException 282 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_AIOOB_EX> 283 * 284 * @see AUM#update(TagNode, String, String, SD) 285 * @see TagNode#isTagNode() 286 * @see TagNode#isClosing 287 */ 288 @LinkJavaSource(handle="Update", name="update", paramCount=6) 289 public static int[] update( 290 Vector<? super TagNode> html, 291 AUM mode, 292 int[] posArr, 293 String innerTag, 294 IntTFunction<TagNode, String> newITValueStrGetter, 295 SD quote 296 ) 297 { return Update.update(html, mode, posArr, innerTag, newITValueStrGetter, quote); } 298 299 300 // ******************************************************************************************** 301 // ******************************************************************************************** 302 // Remove All Attributes 303 // ******************************************************************************************** 304 // ******************************************************************************************** 305 306 307 /** <BR>See Documentation: {@link #removeAll(Vector, int, int)} */ 308 @IntoHTMLTable( 309 background=BlueDither, 310 title="Remove all Attributes from any TagNode which has an Attribute" 311 ) 312 @LinkJavaSource(handle="RemoveAll", name="removeAll", paramCount=3) 313 public static int[] removeAll(Vector<? super TagNode> html) 314 { return RemoveAll.removeAll(html, 0, -1); } 315 316 /** 317 * <BR>Receives: {@code DotPair} 318 * <BR>See Documentation: {@link #removeAll(Vector, int, int)} 319 */ 320 @IntoHTMLTable( 321 background=GreenDither, 322 title="Remove all Attributes from any TagNode which has an Attribute" 323 ) 324 @LinkJavaSource(handle="RemoveAll", name="removeAll", paramCount=3) 325 public static int[] removeAll(Vector<? super TagNode> html, DotPair dp) 326 { return RemoveAll.removeAll(html, dp.start, dp.end + 1); } 327 328 /** 329 * The purpose of this method is to remove all attributes / Inner-Tag 330 * <B STYLE="color: red;">key-value pairs</B> from each and every non-{@code 'TextNode'} and 331 * non-{@code 'CommentNode'} HTML Element found on the vectorized-html page parameter 332 * {@code 'html'}. The removal process is limited to the range specified by method-parameters 333 * {@code sPos, ePos.} 334 * 335 * <BR /><BR /><B CLASS=JDDescLabel>Attribute Removal Specifics:</B> 336 * 337 * <BR />This method will remove each and every {@code class=... id=... src=... alt=...} 338 * {@code href=... onclick=... etc...} attribute from all {@link TagNode}-instances whose 339 * {@code Vector}-index location inside {@code 'html'} falls between {@code 'sPos'} and 340 * {@code 'ePos'}. 341 * 342 * <BR /><BR />When this method exists, all {@link TagNode} instances inside {@code 'html'} 343 * that fall within the specified sub-range will be attribute-free. 344 * 345 * <EMBED CLASS='external-html' DATA-PROC_TYPE=removal DATA-FILE-ID=ATTR_RESTRICT_SE_POS> 346 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_REMOVEALL_EXAMPLE1> 347 * 348 * @param html <EMBED CLASS='external-html' DATA-FILE-ID=HTMLVECSUP> 349 * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSVEC> 350 * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSVEC> 351 * 352 * @return An integer array of {@code 'Vector'}-index positions / locations for each and every 353 * HTML {@code 'TagNode'} whose attributes have been removed. 354 * 355 * @throws IndexOutOfBoundsException <EMBED CLASS='external-html' DATA-FILE-ID=VIOOBEX> 356 * 357 * @see TagNode#removeAllAV 358 * @see TagNode#isTagNode() 359 * @see TagNode#isClosing 360 * @see LV 361 */ 362 @LinkJavaSource(handle="RemoveAll", name="removeAll", paramCount=3) 363 public static int[] removeAll 364 (Vector<? super TagNode> html, int sPos, int ePos) 365 { return RemoveAll.removeAll(html, sPos, ePos); } 366 367 /** 368 * The purpose of this method is to remove all attributes / Inner-Tag 369 * <B STYLE="color: red;">key-value pairs</B> from each and every non-{@code 'TextNode'} and 370 * non-{@code 'CommentNode'} HTML Element found on the vectorized-html page parameter 371 * {@code 'html'}. The removal process is limited to the only removing attributes from elements 372 * pointed to by the contents of passed-parameter {@code 'posArr'} 373 * 374 * <BR /><BR /><B CLASS=JDDescLabel>Attribute Removal Specifics:</B> 375 * 376 * <BR />This method will remove each and every {@code class=... id=... src=... alt=...} 377 * {@code href=... onclick=... etc...} attribute from all {@link TagNode}-instances whose 378 * {@code Vector}-index location within {@code 'html'} are indices among those listed by 379 * the index-list {@code int[]}-Array {@code 'posArr'}. 380 * 381 * <BR /><BR />When this method exits, all {@link TagNode} instances inside {@code 'html'} 382 * specified by {@code 'posArr'} will be attribute-free. 383 * 384 * <EMBED CLASS='external-html' DATA-PROC_TYPE=removal DATA-FILE-ID=ATTR_RESTRICT_POSARR> 385 * 386 * @param html <EMBED CLASS='external-html' DATA-FILE-ID=HTMLVECSUP> 387 * @param posArr <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_POS_ARR_PARAM> 388 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_REMOVEALL_EXAMPLE2> 389 * 390 * @return An integer array of {@code 'Vector'}-index positions / locations for each and every 391 * HTML {@code 'TagNode'} whose attributes have been removed. 392 * 393 * @throws ArrayIndexOutOfBoundsException 394 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_AIOOB_EX> 395 * @throws OpeningTagNodeExpectedException 396 * <EMBED CLASS='external-html' DATA-FILE-ID=OPEN_TNE_EX> 397 * 398 * @throws TagNodeExpectedException <EMBED CLASS='external-html' DATA-FILE-ID=TNE_EX> 399 * 400 * @see TagNode#removeAllAV() 401 * @see TagNode#isTagNode() 402 * @see TagNode#isClosing 403 */ 404 @LinkJavaSource(handle="RemoveAll", name="removeAll", paramCount=2) 405 public static int[] removeAll(Vector<? super TagNode> html, int[] posArr) 406 { return RemoveAll.removeAll(html, posArr); } 407 408 409 // ******************************************************************************************** 410 // ******************************************************************************************** 411 // Remove Data-Attributes 412 // ******************************************************************************************** 413 // ******************************************************************************************** 414 415 416 /** <BR>See Documentation: {@link #removeData(Vector, int, int)} */ 417 @IntoHTMLTable( 418 background=BlueDither, 419 title="Remove all DATA-* Attributes from any TagNode which has a Data-Attribute" 420 ) 421 @LinkJavaSource(handle="RemoveData", name="removeData", paramCount=3) 422 public static int[] removeData(Vector<? super TagNode> html) 423 { return RemoveData.removeData(html, 0, -1); } 424 425 /** 426 * <BR>Receives: {@code DotPair} 427 * <BR>See Documentation: {@link #removeData(Vector, int, int)} 428 */ 429 @IntoHTMLTable( 430 background=GreenDither, 431 title="Remove all DATA-* Attributes from any TagNode which has a Data-Attribute" 432 ) 433 @LinkJavaSource(handle="RemoveData", name="removeData", paramCount=3) 434 public static int[] removeData(Vector<? super TagNode> html, DotPair dp) 435 { return RemoveData.removeData(html, dp.start, dp.end + 1); } 436 437 /** 438 * The purpose of this method is to remove all HTML <B STYLE="color: red;">data</B>-attribute 439 * <B STYLE="color: red;">key-value</B> pairs from {@code 'TagNode'} Elements contained inside 440 * parameter {@code 'html'}. 441 * 442 * <EMBED CLASS='external-html' DATA-PROC_TYPE=removal DATA-FILE-ID=ATTR_RESTRICT_SE_POS> 443 * 444 * @param html <EMBED CLASS='external-html' DATA-FILE-ID=HTMLVECSUP> 445 * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSVEC> 446 * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSVEC> 447 * @return <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_INT_ARR_RET> 448 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_DATA_ATTR_RET_NOTE> 449 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_POSARR_SHORT_EXPL> 450 * 451 * @throws IndexOutOfBoundsException <EMBED CLASS='external-html' DATA-FILE-ID=VIOOBEX> 452 * 453 * @see TagNode#removeDataAttributes() 454 * @see TagNode#isTagNode() 455 * @see TagNode#isClosing 456 * @see LV 457 */ 458 @LinkJavaSource(handle="RemoveData", name="removeData", paramCount=3) 459 public static int[] removeData(Vector<? super TagNode> html, int sPos, int ePos) 460 { return RemoveData.removeData(html, sPos, ePos); } 461 462 /** 463 * The purpose of this method is to remove all HTML <B STYLE="color: red;">data</B>-attribute 464 * <B STYLE="color: red;">key-value</B> pairs from {@code 'TagNode'} Elements contained inside 465 * parameter {@code 'html'}. 466 * 467 * <EMBED CLASS='external-html' DATA-PROC_TYPE=removal DATA-FILE-ID=ATTR_RESTRICT_POSARR> 468 * 469 * @param html <EMBED CLASS='external-html' DATA-FILE-ID=HTMLVECSUP> 470 * @param posArr <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_POS_ARR_PARAM> 471 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_DATA_ATTR_EXAMPLE> 472 * @return <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_INT_ARR_RET> 473 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_DATA_ATTR_RET_NOTE> 474 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_POSARR_SHORT_EXPL> 475 * 476 * @throws ArrayIndexOutOfBoundsException 477 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_AIOOB_EX> 478 * @throws OpeningTagNodeExpectedException 479 * <EMBED CLASS='external-html' DATA-FILE-ID=OPEN_TNE_EX> 480 * 481 * @throws TagNodeExpectedException <EMBED CLASS='external-html' DATA-FILE-ID=TNE_EX> 482 * 483 * @see TagNode#removeDataAttributes() 484 * @see TagNode#isTagNode() 485 * @see TagNode#isClosing 486 */ 487 @LinkJavaSource(handle="RemoveData", name="removeData", paramCount=2) 488 public static int[] removeData(Vector<? super TagNode> html, int[] posArr) 489 { return RemoveData.removeData(html, posArr); } 490 491 492 // ******************************************************************************************** 493 // ******************************************************************************************** 494 // Remove Specified Attributes 495 // ******************************************************************************************** 496 // ******************************************************************************************** 497 498 499 /** <BR>See Documentation: {@link #remove(Vector, int, int, String[])} */ 500 @IntoHTMLTable( 501 background=BlueDither, 502 title= 503 "Remove Attributes from any TagNode having an " + 504 "Attribute-<SPAN STYLE='color: red !important'>name</SPAN> matching " + 505 "<CODE>'innerTags[]'</CODE>" 506 ) 507 @LinkJavaSource(handle="Remove", name="remove", paramCount=4) 508 public static int[] remove(Vector<? super TagNode> html, String... innerTags) 509 { return Remove.remove(html, 0, -1, innerTags); } 510 511 /** 512 * <BR>Receives: {@code DotPair} 513 * <BR>See Documentation: {@link #remove(Vector, int, int, String[])} 514 */ 515 @IntoHTMLTable( 516 background=GreenDither, 517 title= 518 "Remove Attributes from any TagNode having an " + 519 "Attribute-<SPAN STYLE='color: red !important'>name</SPAN> matching " + 520 "<CODE>'innerTags[]'</CODE>" 521 ) 522 @LinkJavaSource(handle="Remove", name="remove", paramCount=4) 523 public static int[] remove(Vector<? super TagNode> html, DotPair dp, String... innerTags) 524 { return Remove.remove(html, dp.start, dp.end + 1, innerTags); } 525 526 /** 527 * This will remove all copies of the attributes whose <B STYLE="color: red;">names</B> are 528 * listed among the by {@code String[]} array parameter {@code 'innerTags'} from the 529 * vectorized-html web-page parameter {@code 'html'}. 530 * 531 * <EMBED CLASS='external-html' DATA-PROC_TYPE=removal DATA-FILE-ID=ATTR_RESTRICT_SE_POS> 532 * 533 * @param html <EMBED CLASS='external-html' DATA-FILE-ID=HTMLVECSUP> 534 * @param innerTags <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_INNERTAGS_PARAM> 535 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_SE_RESTRICT_REM> 536 * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSVEC> 537 * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSVEC> 538 * @return <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_INT_ARR_RET> 539 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_VARARGS_S_RET_NOTE> 540 * 541 * @throws InnerTagKeyException <EMBED CLASS='external-html' DATA-FILE-ID=ITKEYEX> 542 * @throws IndexOutOfBoundsException <EMBED CLASS='external-html' DATA-FILE-ID=VIOOBEX> 543 * @throws IllegalArgumentException If parameter {@code 'innerTags'} has zero elements. 544 * 545 * @see TagNode#removeAttributes(String[]) 546 * @see LV 547 * @see TagNode#hasOR(boolean, String[]) 548 * @see TagNode#isTagNode() 549 * @see TagNode#isClosing 550 * @see InnerTagKeyException#check(String[]) 551 */ 552 @LinkJavaSource(handle="Remove", name="remove", paramCount=4) 553 public static int[] remove 554 (Vector<? super TagNode> html, int sPos, int ePos, String... innerTags) 555 { return Remove.remove(html, sPos, ePos, innerTags); } 556 557 /** 558 * This will remove all copies of the attributes whose <B STYLE="color: red;">names</B> are 559 * listed among the by {@code String[]} array parameter {@code 'innerTags'} from the 560 * vectorized-html web-page parameter {@code 'html'}. 561 * 562 * <EMBED CLASS='external-html' DATA-PROC_TYPE=removal DATA-FILE-ID=ATTR_RESTRICT_POSARR> 563 * 564 * @param html <EMBED CLASS='external-html' DATA-FILE-ID=HTMLVECSUP> 565 * @param innerTags <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_INNERTAGS_PARAM> 566 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_PA_RESTRICT_REM> 567 * @param posArr <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_POS_ARR_PARAM> 568 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_VARARGS_S_EXAMPLE> 569 * @return <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_INT_ARR_RET> 570 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_VARARGS_S_RET_NOTE> 571 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_POSARR_SHORT_EXPL> 572 * 573 * @throws InnerTagKeyException 574 * <EMBED CLASS='external-html' DATA-FILE-ID=ITKEYEX> 575 * @throws ArrayIndexOutOfBoundsException 576 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_AIOOB_EX> 577 * @throws OpeningTagNodeExpectedException 578 * <EMBED CLASS='external-html' DATA-FILE-ID=OPEN_TNE_EX> 579 * 580 * @throws TagNodeExpectedException <EMBED CLASS='external-html' DATA-FILE-ID=TNE_EX> 581 * @throws IllegalArgumentException If parameter {@code 'innerTags'} has zero elements. 582 * 583 * @see TagNode#removeAttributes(String[]) 584 * @see TagNode#hasOR(boolean, String[]) 585 * @see TagNode#isTagNode() 586 * @see TagNode#isClosing 587 * @see InnerTagKeyException#check(String[]) 588 */ 589 @LinkJavaSource(handle="Remove", name="remove", paramCount=3) 590 public static int[] remove(Vector<? super TagNode> html, int[] posArr, String... innerTags) 591 { return Remove.remove(html, posArr, innerTags); } 592 593 594 // ******************************************************************************************** 595 // ******************************************************************************************** 596 // Retrieve Attributes 597 // ******************************************************************************************** 598 // ******************************************************************************************** 599 600 601 /** <BR>See Documentation: {@link #retrieve(Vector, int, int, String)} */ 602 @IntoHTMLTable( 603 background=BlueDither, 604 title= 605 "Retrieve the Attribute-<SPAN STYLE='color: red !important'>value</SPAN> from any TagNode having an " + 606 "Attribute-<SPAN STYLE='color: red !important'>name</SPAN> matching <CODE>'attribute'</CODE>" 607 ) 608 @LinkJavaSource(handle="Retrieve", name="retrieve", paramCount=4) 609 public static Ret2<int[], String[]> retrieve(Vector<? super TagNode> html, String attribute) 610 { return Retrieve.retrieve(html, 0, -1, attribute); } 611 612 /** 613 * <BR>Receives: {@code DotPair} 614 * <BR>See Documentation: {@link #retrieve(Vector, int, int, String)} 615 */ 616 @IntoHTMLTable( 617 background=GreenDither, 618 title= 619 "Retrieve the Attribute-<SPAN STYLE='color:red !important'>value</SPAN> from any TagNode having an " + 620 "Attribute-<SPAN STYLE='color:red !important'>name</SPAN> matching <CODE>'attribute'</CODE>" 621 ) 622 @LinkJavaSource(handle="Retrieve", name="retrieve", paramCount=4) 623 public static Ret2<int[], String[]> retrieve 624 (Vector<? super TagNode> html, DotPair dp, String attribute) 625 { return Retrieve.retrieve(html, dp.start, dp.end + 1, attribute); } 626 627 /** 628 * The purpose of this method is to retrieve the <B STYLE="color: red">value</B> of each 629 * attribute in each {@code TagNode} in an HTML {@code Vector} (or sub-{@code Vector}) that 630 * contained such an attribute. 631 * 632 * <EMBED CLASS='external-html' DATA-PROC_TYPE=retrieval DATA-FILE-ID=ATTR_RESTRICT_SE_POS> 633 * 634 * @param html <EMBED CLASS='external-html' DATA-FILE-ID=HTMLVEC> 635 * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSVEC> 636 * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSVEC> 637 * @param attribute <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_ATTR_RETR_SE_PARAM> 638 * 639 * @throws InnerTagKeyException If the attribute <B STYLE="color: red;">name</B> passed to 640 * this parameter does not contain the <B STYLE="color: red;">name</B> of a valid HTML5 641 * attribute, then this exception shall throw. 642 * 643 * @throws IndexOutOfBoundsException 644 * <EMBED CLASS='external-html' DATA-FILE-ID=VIOOBEX> 645 * 646 * @return <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_RETRIEVE_SE_RET> 647 * 648 * @see TagNode#AV(String) 649 * @see TagNode#isTagNode() 650 * @see TagNode#isClosing 651 * @see InnerTagKeyException#check(String[]) 652 * @see LV 653 */ 654 @LinkJavaSource(handle="Retrieve", name="retrieve", paramCount=4) 655 public static Ret2<int[], String[]> retrieve 656 (Vector<? super TagNode> html, int sPos, int ePos, String attribute) 657 { return Retrieve.retrieve(html, sPos, ePos, attribute); } 658 659 /** 660 * This shall visit each {@link TagNode} indicated by the {@code int[]}-Array parameter 661 * {@code 'posArr'}), and then query those {@code TagNode's} for the 662 * Attribute-<B STYLE="color: red;">value</B> of the attribute named by 663 * {@code String}-Parameter {@code 'attribute'} 664 * 665 * <BR /><BR />The <B STYLE="color: red;">value</B> of each of these attributes will be 666 * recorded to a parallel {@code String}-array and returned. This {@code String[]} array shall 667 * be parallel to the input {@code Vector}-index {@code 'posArr'} parameter. 668 * 669 * <EMBED CLASS='external-html' DATA-PROC_TYPE=retrieval DATA-FILE-ID=ATTR_RESTRICT_POSARR> 670 * 671 * @param html <EMBED CLASS='external-html' DATA-FILE-ID=HTMLVEC> 672 * 673 * @param posArr This shall be a list of {@code Vector}-indices that contain opening 674 * {@code TagNode} elements. The <B STYLE="color: red;">value</B> of the attribute provided by 675 * parameter {@code 'attribute'} will be returned in a parallel {@code String[]} array for each 676 * {@code TagNode} identified by {@code 'posArr'}. 677 * 678 * @param attribute <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_ATTR_RETR_PA_PARAM> 679 * @return <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_RETRIEVE_PA_RET> 680 * 681 * @throws InnerTagKeyException If the {@code String} provided to parameter {@code 'attribute'} 682 * is not a valid HTML-5 attribute-<B STYLE="color: red;">name</B>, then this exception shall 683 * thow. 684 * 685 * @throws ArrayIndexOutOfBoundsException 686 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_AIOOB_EX> 687 * @throws OpeningTagNodeExpectedException 688 * <EMBED CLASS='external-html' DATA-FILE-ID=OPEN_TNE_EX> 689 * 690 * @throws TagNodeExpectedException <EMBED CLASS='external-html' DATA-FILE-ID=TNE_EX> 691 * 692 * @see InnerTagKeyException#check(String[]) 693 * @see TagNode#AV(String) 694 * @see TagNode#isTagNode() 695 * @see TagNode#isClosing 696 */ 697 @LinkJavaSource(handle="Retrieve", name="retrieve", paramCount=3) 698 public static String[] retrieve(Vector<? super TagNode> html, int[] posArr, String attribute) 699 { return Retrieve.retrieve(html, posArr, attribute); } 700 701 702 // ******************************************************************************************** 703 // ******************************************************************************************** 704 // Functional Interface Filter 705 // ******************************************************************************************** 706 // ******************************************************************************************** 707 708 709 /** 710 * Lambda-target for creating attribute-filters. 711 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTRIBUTES_FILTER> 712 */ 713 @FunctionalInterface 714 public interface Filter 715 { 716 /** 717 * This receives the contents of a {@code 'TagNode'} - after the html-tag and the 718 * inner-tags have been extracted. This method is intended to be used to selectively 719 * remove specific inner-tags / attributes that the programmer would like to see removed. 720 * 721 * <BR /><BR /><EMBED CLASS='external-html' DATA-FILE-ID=FUNC_INTER_METH> 722 * 723 * @param htmlTag When this method is implemented by a class, or by a lambda-expression, 724 * the user will receive a copy of a TagNode's {@code TagNode.tok} field through this 725 * parameter. The class or lambda-expression which implements method 726 * {@code 'filter(...)'} may use the {@code String} that is passed via the 727 * {@code 'htmlTag'} parameter to, possibly - if needed, help decide which attributes to 728 * remove from the {@code java.util.Properties} parameter {@code 'attributes'} 729 * 730 * @param attributes When this method, {@code 'filter(...)'}, is implemented by a class or 731 * a lambda-expression, he or she is tasked with eliminating any attributes in this 732 * {@code Properties} class that he wishes to filter. 733 * 734 * <BR /><BR /><B><SPAN STYLE="color: red;">NOTE:</B></SPAN> The 735 * <B STYLE="color: red;">key-value</B> pairs of this {@code java.util.Properties} method 736 * are generated by calling 737 * {@link TagNode#allAV(boolean, boolean)}. The <B STYLE="color: red;">values</B> 738 * returned by that method will all have their original quotation-marks included in the 739 * <CODE><B STYLE="color: red;">'value'</B> String</CODE>. 740 * 741 * <BR /><BR /><B>ALSO:</B> This class is intended to function as a filter, and should be 742 * used to remove property <B STYLE="color: red;">key-value</B> pairs from the attributes 743 * parameter received here. However, there is nothing stopping the programmer from 744 * modifying the contents by adding properties, or even changing the 745 * <B STYLE="color: red;">values</B> of the properties. 746 * 747 * @return This method must return a boolean indicating whether or not the attributes 748 * parameter has been changed in any way. If {@code FALSE} were returned, but the class or 749 * lambda-expression which implements this method has modified the attributes 750 * {@code Properties} instance, the changes that were made would be lost, and the 751 * vectorized-html page that contained the {@code TagNode} wouldn't be updated with the 752 * new {@code TagNode}. 753 * 754 * @see TagNode#allAV(boolean, boolean) 755 * @see TagNode#tok 756 */ 757 public boolean filter(String htmlTag, Properties attributes); 758 } 759 760 761 // ******************************************************************************************** 762 // ******************************************************************************************** 763 // Use BiPredicate to Filter Attributes 764 // ******************************************************************************************** 765 // ******************************************************************************************** 766 767 768 /** 769 * Convenience Method. 770 * <BR />See Documentation: {@link #update(Vector, int, int, Filter)} 771 */ 772 @LinkJavaSource(handle="UpdateWithFilter", name="update", paramCount=4) 773 public static int[] update(Vector<? super TagNode> html, Filter f) 774 { return UpdateWithFilter.update(html, 0, -1, f); } 775 776 /** 777 * Convenience Method. 778 * <BR />Receives: {@code DotPair} 779 * <BR />See Documentation: {@link #update(Vector, int, int, Filter)} 780 */ 781 @LinkJavaSource(handle="UpdateWithFilter", name="update", paramCount=4) 782 public static int[] update(Vector<? super TagNode> html, DotPair dp, Filter f) 783 { return UpdateWithFilter.update(html, dp.start, dp.end + 1, f); } 784 785 /** 786 * Modifies the contents of each instance of a {@code 'TC.OpeningTags'} element found in the 787 * input {@code Vector}. The type of update that's performed is defined by the parameter 788 * {@code Filter 'f'}. Each time a {@code TagNode} found in the input vectorized-html web-page, 789 * or html sub-list, is changed or modified the, original {@code TagNode} will be removed and 790 * replaced by a new, modified {@code TagNode} instance. 791 * 792 * <EMBED CLASS='external-html' DATA-PROC_TYPE=filtering DATA-FILE-ID=ATTR_RESTRICT_SE_POS> 793 * 794 * @param html <EMBED CLASS='external-html' DATA-FILE-ID=HTMLVECSUP> 795 * @param f <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_FILTER_PARAM> 796 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_SE_RESTRICT_REM> 797 * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSVEC> 798 * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSVEC> 799 * 800 * @throws InnerTagKeyException <EMBED CLASS='external-html' DATA-FILE-ID=ITKEX> 801 * @throws IndexOutOfBoundsException <EMBED CLASS='external-html' DATA-FILE-ID=VIOOBEX> 802 * @throws QuotesException <EMBED CLASS='external-html' DATA-FILE-ID=QEX> 803 * 804 * @return <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_INT_ARR_RET> 805 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_FILTER_RET_NOTE> 806 * 807 * @see TagNode#allAV(boolean, boolean) 808 * @see TagNode#isTagNode() 809 * @see TagNode#isClosing 810 * @see LV 811 */ 812 @LinkJavaSource(handle="UpdateWithFilter", name="update", paramCount=4) 813 public static int[] update(Vector<? super TagNode> html, int sPos, int ePos, Filter f) 814 { return UpdateWithFilter.update(html, sPos, ePos, f); } 815 816 /** 817 * Filters the contents of each instance of a {@code 'TC.OpeningTags'} element in the input 818 * {@code Vector}. The type of filter performed is defined by the parameter 819 * {@code Filter 'f'}. Each time a {@code TagNode} in the input vectorized-html web-page, or 820 * html sub-list, is changed or modified the original {@code TagNode} will be removed and 821 * replaced by a new, updated or modified {@code TagNode} instance. 822 * 823 * <EMBED CLASS='external-html' DATA-PROC_TYPE=filtering DATA-FILE-ID=ATTR_RESTRICT_POSARR> 824 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_FILTER_EXAMPLE> 825 * 826 * @param html <EMBED CLASS='external-html' DATA-FILE-ID=HTMLVECSUP> 827 * @param f <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_FILTER_PARAM> 828 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_PA_RESTRICT_REM> 829 * @param posArr <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_POS_ARR_PARAM> 830 * 831 * @throws ArrayIndexOutOfBoundsException 832 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_AIOOB_EX> 833 * @throws OpeningTagNodeExpectedException 834 * <EMBED CLASS='external-html' DATA-FILE-ID=OPEN_TNE_EX> 835 * 836 * @throws InnerTagKeyException <EMBED CLASS='external-html' DATA-FILE-ID=ITKEX> 837 * @throws QuotesException <EMBED CLASS='external-html' DATA-FILE-ID=QEX> 838 * @throws TagNodeExpectedException <EMBED CLASS='external-html' DATA-FILE-ID=TNE_EX> 839 * 840 * @return <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_INT_ARR_RET> 841 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_FILTER_RET_NOTE> 842 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_POSARR_SHORT_EXPL> 843 * 844 * @see TagNode#allAV(boolean, boolean) 845 * @see TagNode#isTagNode() 846 * @see TagNode#isClosing 847 */ 848 @LinkJavaSource(handle="UpdateWithFilter", name="update", paramCount=3) 849 public static int[] update(Vector<? super TagNode> html, int[] posArr, Filter f) 850 { return UpdateWithFilter.update(html, posArr, f); } 851 852 853 // ******************************************************************************************** 854 // ******************************************************************************************** 855 // Use Attribute White-Lists to Filter Attributes 856 // ******************************************************************************************** 857 // ******************************************************************************************** 858 859 860 /** 861 * Convenience Method. 862 * <BR />See Documentation: {@link #filter(Vector, int, int, String[])} 863 */ 864 @LinkJavaSource(handle="WhiteListFilter", name="filter", paramCount=4) 865 public static int[] filter(Vector<? super TagNode> html, String... innerTagWhiteList) 866 { return WhiteListFilter.filter(html, 0, -1, innerTagWhiteList); } 867 868 /** 869 * Convenience Method. 870 * <BR />Receives: {@code DotPair} 871 * <BR />See Documentation: {@link #filter(Vector, int, int, String[])} 872 */ 873 @LinkJavaSource(handle="WhiteListFilter", name="filter", paramCount=4) 874 public static int[] filter 875 (Vector<? super TagNode> html, DotPair dp, String... innerTagWhiteList) 876 { return WhiteListFilter.filter(html, dp.start, dp.end + 1, innerTagWhiteList); } 877 878 /** 879 * Filters the contents of each instance of a {@code 'TC.OpeningTags'} element in the input 880 * {@code Vector} using an attribute {@code 'white-list'}. All input-{@code Vector TagNode's} 881 * that have attributes whose <B STYLE="color: red;">names</B> are not members of the inner-tag 882 * {@code white-list} will be removed, and a new {@code TagNode} whose only attributes are 883 * members of the innerTag {@code white-list} will replace the old {@code TagNode}. 884 * 885 * <EMBED CLASS='external-html' DATA-PROC_TYPE=removal DATA-FILE-ID=ATTR_RESTRICT_SE_POS> 886 * 887 * @param html <EMBED CLASS='external-html' DATA-FILE-ID=HTMLVECSUP> 888 * @param innerTagWhiteList <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_WHITE_LIST_PARAM> 889 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_SE_RESTRICT_REM> 890 * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSVEC> 891 * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSVEC> 892 * 893 * @throws IndexOutOfBoundsException <EMBED CLASS='external-html' DATA-FILE-ID=VIOOBEX> 894 * 895 * @return <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_INT_ARR_RET> 896 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_WHITE_L_RET_NOTE> 897 * 898 * @see TagNode#allAN(boolean, boolean) 899 * @see TagNode#isTagNode() 900 * @see TagNode#removeAttributes(String[]) 901 * @see TagNode#isClosing 902 * @see LV 903 */ 904 @LinkJavaSource(handle="WhiteListFilter", name="filter", paramCount=4) 905 public static int[] filter 906 (Vector<? super TagNode> html, int sPos, int ePos, String... innerTagWhiteList) 907 { return WhiteListFilter.filter(html, sPos, ePos, innerTagWhiteList); } 908 909 /** 910 * Filters the contents of each instance of a {@code 'TC.OpeningTags'} element in the input 911 * {@code Vector} using an attribute {@code 'white-list'}. All input-{@code Vector TagNode's} 912 * that have attributes whose <B STYLE="color: red;">names</B> are not members of the inner-tag 913 * {@code white-list} will be removed, and a new {@code TagNode} whose only attributes are 914 * members of the innerTag {@code white-list} will replace the old {@code TagNode}. 915 * 916 * <EMBED CLASS='external-html' DATA-PROC_TYPE=removal DATA-FILE-ID=ATTR_RESTRICT_POSARR> 917 * 918 * @param html <EMBED CLASS='external-html' DATA-FILE-ID=HTMLVECSUP> 919 * @param innerTagWhiteList <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_WHITE_LIST_PARAM> 920 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_PA_RESTRICT_REM> 921 * @param posArr <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_POS_ARR_PARAM> 922 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_WHITE_LIST_EXAMPLE> 923 * 924 * @throws ArrayIndexOutOfBoundsException 925 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_AIOOB_EX> 926 * @throws TagNodeExpectedException 927 * <EMBED CLASS='external-html' DATA-FILE-ID=TNE_EX> 928 * @throws OpeningTagNodeExpectedException 929 * <EMBED CLASS='external-html' DATA-FILE-ID=OPEN_TNE_EX> 930 * 931 * @return <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_INT_ARR_RET> 932 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_WHITE_L_RET_NOTE> 933 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_POSARR_SHORT_EXPL> 934 * 935 * @see TagNode#allAN(boolean, boolean) 936 * @see TagNode#removeAttributes(String[]) 937 * @see TagNode#isTagNode() 938 * @see TagNode#isClosing 939 */ 940 @LinkJavaSource(handle="WhiteListFilter", name="filter", paramCount=3) 941 public static int[] filter 942 (Vector<? super TagNode> html, int[] posArr, String... innerTagWhiteList) 943 { return WhiteListFilter.filter(html, posArr, innerTagWhiteList); } 944 945 946 // ******************************************************************************************** 947 // ******************************************************************************************** 948 // Use class StrFilter to Filter Attributes 949 // ******************************************************************************************** 950 // ******************************************************************************************** 951 952 953 /** 954 * Convenience Method. 955 * <BR />See Documentation: {@link #filter(Vector, int, int, StrFilter)} 956 */ 957 @LinkJavaSource(handle="UsingStrFilter", name="filter", paramCount=4) 958 public static int[] filter(Vector<? super TagNode> html, StrFilter filter) 959 { return UsingStrFilter.filter(html, 0, -1, filter); } 960 961 /** 962 * Convenience Method. 963 * <BR />Receives: {@code DotPair} 964 * <BR />See Documentation: {@link #filter(Vector, int, int, StrFilter)} 965 */ 966 @LinkJavaSource(handle="UsingStrFilter", name="filter", paramCount=4) 967 public static int[] filter(Vector<? super TagNode> html, DotPair dp, StrFilter filter) 968 { return UsingStrFilter.filter(html, dp.start, dp.end + 1, filter); } 969 970 /** 971 * Filters the contents of each instance of a {@code 'TC.OpeningTags'} element in the input 972 * {@code Vector} using a {@link StrFilter}. All input-{@code Vector TagNode's} which have 973 * attributes will have the list of attribute-<B STYLE="color: red;">names</B> tested against 974 * the provided {@code StrFilter.test(attribute)} predicate. 975 * 976 * <BR /><BR />If any attribute whose <B STYLE="color: red;">name</B> fails the 977 * {@code Predicate} test, then that attribute will be removed. After testing all of a 978 * {@code TagNode's} inner-tags, if any of those attributes did fail the 979 * {@code StrFilter.test(...)} method, a new {@code TagNode} will be constructed leaving those 980 * out. Finally, the old {@code TagNode} will be removed from input HTML {@code Vector}, and 981 * replaced with the new one. 982 * 983 * <EMBED CLASS='external-html' DATA-PROC_TYPE=filtering DATA-FILE-ID=ATTR_RESTRICT_SE_POS> 984 * 985 * @param html <EMBED CLASS='external-html' DATA-FILE-ID=HTMLVECSUP> 986 * @param filter <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_STR_FILTER_PARAM> 987 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_SE_RESTRICT_REM> 988 * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSVEC> 989 * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSVEC> 990 * 991 * @throws IndexOutOfBoundsException <EMBED CLASS='external-html' DATA-FILE-ID=VIOOBEX> 992 * 993 * @return <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_INT_ARR_RET> 994 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_STR_FILT_RET_NOTE> 995 * 996 * @see TagNode#allAN() 997 * @see TagNode#isTagNode() 998 * @see TagNode#isClosing 999 * @see TagNode#removeAttributes(String[]) 1000 * @see LV 1001 */ 1002 @LinkJavaSource(handle="UsingStrFilter", name="filter", paramCount=4) 1003 public static int[] filter 1004 (Vector<? super TagNode> html, int sPos, int ePos, StrFilter filter) 1005 { return UsingStrFilter.filter(html, sPos, ePos, filter); } 1006 1007 /** 1008 * Filters the contents of each instance of a {@code 'TC.OpeningTags'} element in the input 1009 * {@code Vector} using a {@link StrFilter}. All input-{@code Vector TagNode's} which have 1010 * attributes will have the list of attribute-<B STYLE="color: red;">names</B> tested against 1011 * the provided {@code StrFilter.test(attribute)} predicate. 1012 * 1013 * <BR /><BR />If any attribute whose <B STYLE="color: red;">name</B> fails the 1014 * {@code Predicate} test, then that attribute will be removed. After testing all of a 1015 * {@code TagNode's} inner-tags, if any of those attributes did fail the 1016 * {@code StrFilter.test(...)} method, a new {@code TagNode} will be constructed leaving those 1017 * out. Finally, the old {@code TagNode} will be removed from input HTML {@code Vector}, and 1018 * replaced with the new one. 1019 * 1020 * <EMBED CLASS='external-html' DATA-PROC_TYPE=filtering DATA-FILE-ID=ATTR_RESTRICT_POSARR> 1021 * 1022 * @param html <EMBED CLASS='external-html' DATA-FILE-ID=HTMLVECSUP> 1023 * @param filter <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_STR_FILTER_PARAM> 1024 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_PA_RESTRICT_REM> 1025 * @param posArr <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_POS_ARR_PARAM> 1026 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_STR_FILT_EXAMPLE> 1027 * 1028 * @throws ArrayIndexOutOfBoundsException 1029 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_AIOOB_EX> 1030 * @throws OpeningTagNodeExpectedException 1031 * <EMBED CLASS='external-html' DATA-FILE-ID=OPEN_TNE_EX> 1032 * 1033 * @throws TagNodeExpectedException <EMBED CLASS='external-html' DATA-FILE-ID=TNE_EX> 1034 * 1035 * @return <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_INT_ARR_RET> 1036 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_STR_FILT_RET_NOTE> 1037 * <EMBED CLASS='external-html' DATA-FILE-ID=ATTR_POSARR_SHORT_EXPL> 1038 * 1039 * @see TagNode#allAN() 1040 * @see TagNode#isTagNode() 1041 * @see TagNode#isClosing 1042 * @see TagNode#removeAttributes(String[]) 1043 */ 1044 @LinkJavaSource(handle="UsingStrFilter", name="filter", paramCount=3) 1045 public static int[] filter(Vector<? super TagNode> html, int[] posArr, StrFilter filter) 1046 { return UsingStrFilter.filter(html, posArr, filter); } 1047 1048}