-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathAdvancedHTMLParser.Tags.html
More file actions
1368 lines (1165 loc) · 124 KB
/
Copy pathAdvancedHTMLParser.Tags.html
File metadata and controls
1368 lines (1165 loc) · 124 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html ><head ><title >Python: module AdvancedHTMLParser.Tags</title>
<meta charset="utf-8" />
</head><body bgcolor="#f0f0f8" >
<table cellpadding="2" width="100%" border="0" cellspacing="0" summary="heading" >
<tr bgcolor="#7799ee" >
<td valign="bottom" > <br />
<font color="#ffffff" face="helvetica, arial" > <br /><big ><big ><strong ><a href="AdvancedHTMLParser.html" ><font color="#ffffff" >AdvancedHTMLParser</font></a>.Tags</strong></big></big></font></td><td align="right" valign="bottom" ><font color="#ffffff" face="helvetica, arial" ><a href="AdvancedHTMLParser.html" >index</a></font></td></tr></table>
<p ><tt >Copyright (c) 2015, 2016, 2017, 2018, 2019 Tim Savannah under LGPLv3. All Rights Reserved.<br />
<br />
See LICENSE (https://gnu.org/licenses/lgpl-3.0.txt) for more information.<br />
<br />
<br />
<a href="#AdvancedTag" >AdvancedTag</a> and <a href="#TagCollection" >TagCollection</a>, which represent tags and their data, and other related functions.</tt></p>
<p >
<table cellpadding="2" width="100%" border="0" cellspacing="0" summary="section" >
<tr bgcolor="#aa55cc" >
<td colspan="3" valign="bottom" > <br />
<font color="#ffffff" face="helvetica, arial" ><big ><strong >Modules</strong></big></font></td></tr>
<tr ><td bgcolor="#aa55cc" ><tt > </tt></td><td > </td>
<td width="100%" ><table width="100%" summary="list" ><tr ><td width="25%" valign="top" ><a href="QueryableList.html" >QueryableList</a><br />
</td><td width="25%" valign="top" ><a href="copy.html" >copy</a><br />
</td><td width="25%" valign="top" ><a href="re.html" >re</a><br />
</td><td width="25%" valign="top" ><a href="uuid.html" >uuid</a><br />
</td></tr></table></td></tr></table><p >
<table cellpadding="2" width="100%" border="0" cellspacing="0" summary="section" >
<tr bgcolor="#ee77aa" >
<td colspan="3" valign="bottom" > <br />
<font color="#ffffff" face="helvetica, arial" ><big ><strong >Classes</strong></big></font></td></tr>
<tr ><td bgcolor="#ee77aa" ><tt > </tt></td><td > </td>
<td width="100%" ><dl >
<dt ><font face="helvetica, arial" ><a href="QueryableList.Base.html#QueryableListBase" >QueryableList.Base.QueryableListBase</a>(<a href="__builtin__.html#list" >__builtin__.list</a>)
</font></dt><dd >
<dl >
<dt ><font face="helvetica, arial" ><a href="AdvancedHTMLParser.Tags.html#FilterableTagCollection" >FilterableTagCollection</a>
</font></dt></dl>
</dd>
<dt ><font face="helvetica, arial" ><a href="__builtin__.html#list" >__builtin__.list</a>(<a href="__builtin__.html#object" >__builtin__.object</a>)
</font></dt><dd >
<dl >
<dt ><font face="helvetica, arial" ><a href="AdvancedHTMLParser.Tags.html#TagCollection" >TagCollection</a>
</font></dt></dl>
</dd>
<dt ><font face="helvetica, arial" ><a href="__builtin__.html#object" >__builtin__.object</a>
</font></dt><dd >
<dl >
<dt ><font face="helvetica, arial" ><a href="AdvancedHTMLParser.Tags.html#AdvancedTag" >AdvancedTag</a>
</font></dt></dl>
</dd>
</dl>
<p >
<table cellpadding="2" width="100%" border="0" cellspacing="0" summary="section" >
<tr bgcolor="#ffc8d8" >
<td colspan="3" valign="bottom" > <br />
<font color="#000000" face="helvetica, arial" ><a name="AdvancedTag" >class <strong >AdvancedTag</strong></a>(<a href="__builtin__.html#object" >__builtin__.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8" ><td rowspan="2" ><tt > </tt></td>
<td colspan="2" ><tt ><a href="#AdvancedTag" >AdvancedTag</a> - Represents a Tag. Used with AdvancedHTMLParser to create a DOM-model<br />
<br />
Keep tag names lowercase.<br />
<br />
Use the getters and setters instead of attributes directly, or you may lose accounting.<br /> </tt></td></tr>
<tr ><td > </td>
<td width="100%" >Methods defined here:<br />
<dl ><dt ><a name="AdvancedTag-__copy__" ><strong >__copy__</strong></a>(self)</dt><dd ><tt >__copy__ - Create a copy (except uid). This tag will NOT ==.<br />
<br />
but is safe to add to the same tree as its original</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-__deepcopy__" ><strong >__deepcopy__</strong></a>(self, arg)</dt><dd ><tt >__deepcopy__ - Create a copy (except uid) for deepcopy. This tag will NOT ==<br />
<br />
but is safe to add to the same tree as its original</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-__eq__" ><strong >__eq__</strong></a>(self, other)</dt><dd ><tt >__eq__ - Test if this and other are THE SAME TAG.<br />
<br />
Note: this does NOT test if the tags have the same name, attributes, etc.<br />
Use isTagEqual to test if a tag has the same data (other than children)<br />
<br />
So for example:<br />
<br />
tag1 = document.<a href="#AdvancedTag-getElementById" >getElementById</a>('something')<br />
tag2 = copy.copy(tag1)<br />
<br />
tag1 == tag2 # This is False<br />
tag1.<a href="#AdvancedTag-isTagEqual" >isTagEqual</a>(tag2) # This is True</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-__getattribute__" ><strong >__getattribute__</strong></a>(self, name)</dt></dl>
<dl ><dt ><a name="AdvancedTag-__getitem__" ><strong >__getitem__</strong></a>(self, key)</dt></dl>
<dl ><dt ><a name="AdvancedTag-__getstate__" ><strong >__getstate__</strong></a>(self)</dt><dd ><tt >__getstate__ - Get state for pickling<br />
<br />
@return <dict></tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-__hash__" ><strong >__hash__</strong></a>(self)</dt></dl>
<dl ><dt ><a name="AdvancedTag-__init__" ><strong >__init__</strong></a>(self, tagName, attrList<font color="#909090" >=None</font>, isSelfClosing<font color="#909090" >=False</font>, ownerDocument<font color="#909090" >=None</font>)</dt><dd ><tt >__init__ - Construct<br />
<br />
@param tagName - String of tag name. This will be lowercased!<br />
@param attrList - A <a href="__builtin__.html#list" >list</a> of tuples (key, value)<br />
@param isSelfClosing - True if self-closing tag ( <tagName attrs /> ) will be set to False if text or children are added.<br />
@param ownerDocument <None/AdvancedHTMLParser> - The parser (document) associated with this tag, or None for no association</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-__ne__" ><strong >__ne__</strong></a>(self, other)</dt><dd ><tt >__ne__ - Test if this and other are NOT THE SAME TAG. Note<br />
<br />
Note: this does NOT test if the tags have the same name, attributes, etc.<br />
Use isTagEqual to test if a tag has the same data (other than children)<br />
<br />
@see <a href="#AdvancedTag" >AdvancedTag</a>.__eq__<br />
@see <a href="#AdvancedTag" >AdvancedTag</a>.isTagEqual</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-__repr__" ><strong >__repr__</strong></a>(self)</dt><dd ><tt >__repr__ - A reconstructable representation of this <a href="#AdvancedTag" >AdvancedTag</a>.<br />
<br />
TODO: Incorporate uid somehow? Without it the tags won't be the SAME TAG, but they'll be equivilant</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-__setattr__" ><strong >__setattr__</strong></a>(self, name, value)</dt><dd ><tt >__setattr__ - Called with dot-access assignment, like: myTag.attr = "value"<br />
<br />
This method applies the special HTML/JS rules to dot-access,<br />
and allows setting several attributes directly, and conversion on special names<br />
such as myTag.className -> "class" attribute<br />
<br />
@param name <str> - The name of the attribute after the dot<br />
<br />
@param value <multiple types> - The value to assign<br />
<br />
@return - The value assigned ( may not match the passed in #value, for example the attribute<br />
"style" takes a string value, but will return a special type StyleAttribute to support<br />
access with javascript-like behaviour</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-__setstate__" ><strong >__setstate__</strong></a>(self, state)</dt><dd ><tt >__setstate__ - Set state when loading pickle<br />
<br />
@param state <dict></tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-__str__" ><strong >__str__</strong></a>(self)</dt><dd ><tt >__str__ - Returns the HTML representation for this tag (including children).<br />
<br />
NOTE: This changed in 7.3.1 to be equivilant to self.<strong >outerHTML</strong> (or to new getHTML method, which is the same).<br />
<br />
The old method just included the start tag, the joined direct text node children, and the end tag.<br />
This compacts well for debug display, but doesn't give a clear picture of what's going on.<br />
<br />
The old method is still available as <a href="#AdvancedTag" >AdvancedTag</a>._old__str__<br />
<br />
To revert str(myTag) back to the hold behaviour:<br />
<br />
from AdvancedHTMLParser.Tags import <a href="#AdvancedTag" >AdvancedTag</a><br />
<br />
<a href="#AdvancedTag" >AdvancedTag</a>.__str__ = <a href="#AdvancedTag" >AdvancedTag</a>._old__str__</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-addClass" ><strong >addClass</strong></a>(self, className)</dt><dd ><tt >addClass - append a class name to the end of the "class" attribute, if not present<br />
<br />
@param className <str> - The name of the class to add</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-append" ><strong >append</strong></a> = <a href="#AdvancedTag-appendBlock" >appendBlock</a>(self, block)</dt></dl>
<dl ><dt ><a name="AdvancedTag-appendBlock" ><strong >appendBlock</strong></a>(self, block)</dt><dd ><tt >append / appendBlock - Append a block to this element. A block can be a string (text node), or an <a href="#AdvancedTag" >AdvancedTag</a> (tag node)<br />
<br />
@param <str/<a href="#AdvancedTag" >AdvancedTag</a>> - block to add<br />
<br />
@return - #block<br />
<br />
NOTE: To add multiple blocks, @see appendBlocks<br />
If you know the type, use either @see appendChild for tags or @see appendText for text</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-appendBlocks" ><strong >appendBlocks</strong></a>(self, blocks)</dt><dd ><tt >appendBlocks - Append blocks to this element. A block can be a string (text node), or an <a href="#AdvancedTag" >AdvancedTag</a> (tag node)<br />
<br />
@param blocks <a href="__builtin__.html#list" >list</a><str/<a href="#AdvancedTag" >AdvancedTag</a>> - A <a href="__builtin__.html#list" >list</a>, in order to append, of blocks to add.<br />
<br />
@return - #blocks<br />
<br />
NOTE: To add a single block, @see appendBlock<br />
If you know the type, use either @see appendChild for tags or @see appendText for text</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-appendChild" ><strong >appendChild</strong></a>(self, child)</dt><dd ><tt >appendChild - Append a child to this element.<br />
<br />
@param child <<a href="#AdvancedTag" >AdvancedTag</a>> - Append a child element to this element</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-appendInnerHTML" ><strong >appendInnerHTML</strong></a>(self, html)</dt><dd ><tt >appendInnerHTML - Appends nodes from arbitrary HTML as if doing element.innerHTML += 'someHTML' in javascript.<br />
<br />
@param html <str> - Some HTML<br />
<br />
NOTE: If associated with a document ( AdvancedHTMLParser ), the html will use the encoding associated with<br />
that document.<br />
<br />
@return - None. A browser would return innerHTML, but that's somewhat expensive on a high-level node.<br />
So just call .innerHTML explicitly if you need that</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-appendNode" ><strong >appendNode</strong></a> = <a href="#AdvancedTag-appendChild" >appendChild</a>(self, child)</dt></dl>
<dl ><dt ><a name="AdvancedTag-appendText" ><strong >appendText</strong></a>(self, text)</dt><dd ><tt >appendText - append some inner text</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-asHTML" ><strong >asHTML</strong></a> = <a href="#AdvancedTag-toHTML" >toHTML</a>(self)</dt></dl>
<dl ><dt ><a name="AdvancedTag-cloneNode" ><strong >cloneNode</strong></a>(self)</dt><dd ><tt >cloneNode - Clone this node (tag name and attributes). Does not clone children.<br />
<br />
Tags will be equal according to isTagEqual method, but will contain a different internal<br />
unique id such tag origTag != origTag.<a href="#AdvancedTag-cloneNode" >cloneNode</a>() , as is the case in JS DOM.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-contains" ><strong >contains</strong></a>(self, other)</dt><dd ><tt >contains - Check if a provided tag appears anywhere as a direct child to this node, or is this node itself.<br />
<br />
@param other <<a href="#AdvancedTag" >AdvancedTag</a>> - Tag to check<br />
<br />
@return <bool> - True if #other appears anywhere beneath or is this tag, otherwise False</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-containsUid" ><strong >containsUid</strong></a>(self, uid)</dt><dd ><tt >containsUid - Check if the uid (unique internal ID) appears anywhere as a direct child to this node, or the node itself.<br />
<br />
@param uid <uuid.UUID> - uuid to check<br />
<br />
@return <bool> - True if #uid is this node's uid, or is the uid of any children at any level down</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-filter" ><strong >filter</strong></a>(self, **kwargs)</dt><dd ><tt >filter aka filterAnd - Perform a filter operation on this node and all children (and all their children, onto the end)<br />
<br />
Results must match ALL the filter criteria. for ANY, use the *Or methods<br />
<br />
For special filter keys, @see #AdvancedHTMLParser.AdvancedHTMLParser.filter<br />
<br />
Requires the QueryableList module to be installed (i.e. AdvancedHTMLParser was installed<br />
without '--no-deps' flag.)<br />
<br />
For alternative without QueryableList,<br />
consider #AdvancedHTMLParser.AdvancedHTMLParser.find method or the getElement* methods<br />
<br />
@return <a href="#TagCollection" >TagCollection</a><<a href="#AdvancedTag" >AdvancedTag</a>></tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-filterAnd" ><strong >filterAnd</strong></a> = <a href="#AdvancedTag-filter" >filter</a>(self, **kwargs)</dt></dl>
<dl ><dt ><a name="AdvancedTag-filterOr" ><strong >filterOr</strong></a>(self, **kwargs)</dt><dd ><tt >filterOr - Perform a filter operation on this node and all children (and their children, onto the end)<br />
<br />
Results must match ANY the filter criteria. for ALL, use the *AND methods<br />
<br />
For special filter keys, @see #AdvancedHTMLParser.AdvancedHTMLParser.filter<br />
<br />
Requires the QueryableList module to be installed (i.e. AdvancedHTMLParser was installed<br />
without '--no-deps' flag.)<br />
<br />
For alternative without QueryableList,<br />
consider #AdvancedHTMLParser.AdvancedHTMLParser.find method or the getElement* methods<br />
<br />
@return <a href="#TagCollection" >TagCollection</a><<a href="#AdvancedTag" >AdvancedTag</a>></tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getAllChildNodeUids" ><strong >getAllChildNodeUids</strong></a>(self)</dt><dd ><tt >getAllChildNodeUids - Returns all the unique internal IDs for all children, and there children,<br />
so on and so forth until the end.<br />
<br />
For performing "contains node" kind of logic, this is more efficent than copying the entire nodeset<br />
<br />
@return set<uuid.UUID> A set of uuid objects</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getAllChildNodes" ><strong >getAllChildNodes</strong></a>(self)</dt><dd ><tt >getAllChildNodes - Gets all the children, and their children,<br />
and their children, and so on, all the way to the end as a <a href="#TagCollection" >TagCollection</a>.<br />
<br />
Use .childNodes for a regular <a href="__builtin__.html#list" >list</a> of direct children<br />
<br />
@return <a href="#TagCollection" >TagCollection</a><<a href="#AdvancedTag" >AdvancedTag</a>> - A <a href="#TagCollection" >TagCollection</a> of all children (and their children recursive)</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getAllNodeUids" ><strong >getAllNodeUids</strong></a>(self)</dt><dd ><tt >getAllNodeUids - Returns all the unique internal IDs from getAllChildNodeUids, but also includes this tag's uid<br />
<br />
@return set<uuid.UUID> A set of uuid objects</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getAllNodes" ><strong >getAllNodes</strong></a>(self)</dt><dd ><tt >getAllNodes - Returns this node, all children, and all their children and so on till the end<br />
<br />
@return <a href="#TagCollection" >TagCollection</a><<a href="#AdvancedTag" >AdvancedTag</a>></tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getAttribute" ><strong >getAttribute</strong></a>(self, attrName, defaultValue<font color="#909090" >=None</font>)</dt><dd ><tt >getAttribute - Gets an attribute on this tag. Be wary using this for classname, maybe use addClass/removeClass. Attribute names are all lowercase.<br />
@return - The attribute value, or None if none exists.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getAttributesDict" ><strong >getAttributesDict</strong></a>(self)</dt><dd ><tt >getAttributesDict - Get a copy of all attributes as a dict map of name -> value<br />
<br />
ALL values are converted to string and copied, so modifications will not affect the original attributes.<br />
If you want types like "style" to work as before, you'll need to recreate those elements (like StyleAttribute(strValue) ).<br />
<br />
@return <dict ( str(name), str(value) )> - A dict of attrName to attrValue , all as strings and copies.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getAttributesList" ><strong >getAttributesList</strong></a>(self)</dt><dd ><tt >getAttributesList - Get a copy of all attributes as a <a href="__builtin__.html#list" >list</a> of tuples (name, value)<br />
<br />
ALL values are converted to string and copied, so modifications will not affect the original attributes.<br />
If you want types like "style" to work as before, you'll need to recreate those elements (like StyleAttribute(strValue) ).<br />
<br />
@return <a href="__builtin__.html#list" >list</a>< tuple< str(name), str(value) > > - A <a href="__builtin__.html#list" >list</a> of tuples of attrName, attrValue pairs, all converted to strings.<br />
<br />
This is suitable for passing back into <a href="#AdvancedTag" >AdvancedTag</a> when creating a new tag.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getBlocksTags" ><strong >getBlocksTags</strong></a>(self)</dt><dd ><tt >getBlocksTags - Returns a <a href="__builtin__.html#list" >list</a> of tuples referencing the blocks which are direct children of this node, and the block is an <a href="#AdvancedTag" >AdvancedTag</a>.<br />
<br />
The tuples are ( block, blockIdx ) where "blockIdx" is the index of self.<strong >blocks</strong> wherein the tag resides.<br />
<br />
@return <a href="__builtin__.html#list" >list</a>< tuple(block, blockIdx) > - A <a href="__builtin__.html#list" >list</a> of tuples of child blocks which are tags and their index in the self.<strong >blocks</strong> <a href="__builtin__.html#list" >list</a></tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getBlocksText" ><strong >getBlocksText</strong></a>(self)</dt><dd ><tt >getBlocksText - Returns a <a href="__builtin__.html#list" >list</a> of tuples referencing the blocks which are direct children of this node, and the block is a text node (not an <a href="#AdvancedTag" >AdvancedTag</a>)<br />
<br />
The tuples are ( block, blockIdx ) where "blockIdx" is the index of self.<strong >blocks</strong> wherein the text resides.<br />
<br />
@return <a href="__builtin__.html#list" >list</a>< tuple(block, blockIdx) > - A <a href="__builtin__.html#list" >list</a> of tuples of child blocks which are not tags and their index in the self.<strong >blocks</strong> <a href="__builtin__.html#list" >list</a></tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getChildBlocks" ><strong >getChildBlocks</strong></a>(self)</dt><dd ><tt >getChildBlocks - Gets the child blocks, both text and tags.<br />
<br />
@see childBlocks</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getChildren" ><strong >getChildren</strong></a>(self)</dt><dd ><tt >getChildren - returns child nodes as a searchable <a href="#TagCollection" >TagCollection</a>.<br />
<br />
For a plain <a href="__builtin__.html#list" >list</a>, use .children instead<br />
<br />
@return - <a href="#TagCollection" >TagCollection</a> of the immediate children to this tag.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getElementById" ><strong >getElementById</strong></a>(self, _id)</dt><dd ><tt >getElementById - Search children of this tag for a tag containing an id<br />
<br />
@param _id - String of id<br />
<br />
@return - <a href="#AdvancedTag" >AdvancedTag</a> or None</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getElementsByAttr" ><strong >getElementsByAttr</strong></a>(self, attrName, attrValue)</dt><dd ><tt >getElementsByAttr - Search children of this tag for tags with an attribute name/value pair<br />
<br />
@param attrName - Attribute name (lowercase)<br />
@param attrValue - Attribute value<br />
<br />
@return - <a href="#TagCollection" >TagCollection</a> of matching elements</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getElementsByClassName" ><strong >getElementsByClassName</strong></a>(self, className)</dt><dd ><tt >getElementsByClassName - Search children of this tag for tags containing a given class name<br />
<br />
@param className <str> - One or more space-separated class names<br />
<br />
@return - <a href="#TagCollection" >TagCollection</a> of matching elements</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getElementsByName" ><strong >getElementsByName</strong></a>(self, name)</dt><dd ><tt >getElementsByName - Search children of this tag for tags with a given name<br />
<br />
@param name - name to search<br />
<br />
@return - <a href="#TagCollection" >TagCollection</a> of matching elements</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getElementsByXPath" ><strong >getElementsByXPath</strong></a> = <a href="#AdvancedTag-getElementsByXPathExpression" >getElementsByXPathExpression</a>(self, xpathExprStr)</dt></dl>
<dl ><dt ><a name="AdvancedTag-getElementsByXPathExpression" ><strong >getElementsByXPathExpression</strong></a>(self, xpathExprStr)</dt><dd ><tt >getElementsByXPathExpression - Evaluate an XPath expression string, using this node as the root<br />
<br />
<br />
@param xpathExprStr <str> - An XPath expression string (e.x. """//div[@name="someName"]/span[3]""" )<br />
<br />
<br />
@return <<a href="#TagCollection" >TagCollection</a>> - <a href="#TagCollection" >TagCollection</a> of all matching elements<br />
<br />
<br />
@see AdvancedHTMLParser.xpath.XPathExpression.evaluate for additional @throws and similar</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getElementsCustomFilter" ><strong >getElementsCustomFilter</strong></a>(self, filterFunc)</dt><dd ><tt >getElementsCustomFilter - Searches children of this tag for those matching a provided user function<br />
<br />
@param filterFunc <function> - A function or lambda expression that should return "True" if the passed node matches criteria.<br />
<br />
@return - <a href="#TagCollection" >TagCollection</a> of matching results<br />
<br />
@see getFirstElementCustomFilter</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getElementsWithAttrValues" ><strong >getElementsWithAttrValues</strong></a>(self, attrName, attrValues)</dt><dd ><tt >getElementsWithAttrValues - Search children of this tag for tags with an attribute name and one of several values<br />
<br />
@param attrName <lowercase str> - Attribute name (lowercase)<br />
@param attrValues set<str> - set of acceptable attribute values<br />
<br />
@return - <a href="#TagCollection" >TagCollection</a> of matching elements</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getEndTag" ><strong >getEndTag</strong></a>(self)</dt><dd ><tt >getEndTag - returns the end tag representation as HTML string<br />
<br />
@return - String of end tag</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getFirstElementCustomFilter" ><strong >getFirstElementCustomFilter</strong></a>(self, filterFunc)</dt><dd ><tt >getFirstElementCustomFilter - Gets the first element which matches a given filter func.<br />
<br />
Scans first child, to the bottom, then next child to the bottom, etc. Does not include "self" node.<br />
<br />
@param filterFunc <function> - A function or lambda expression that should return "True" if the passed node matches criteria.<br />
<br />
@return <<a href="#AdvancedTag" >AdvancedTag</a>/None> - First match, or None<br />
<br />
@see getElementsCustomFilter</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getHTML" ><strong >getHTML</strong></a> = <a href="#AdvancedTag-toHTML" >toHTML</a>(self)</dt></dl>
<dl ><dt ><a name="AdvancedTag-getParentElementCustomFilter" ><strong >getParentElementCustomFilter</strong></a>(self, filterFunc)</dt><dd ><tt >getParentElementCustomFilter - Runs through parent on up to document root, returning the<br />
<br />
first tag which filterFunc(tag) returns True.<br />
<br />
@param filterFunc <function/lambda> - A function or lambda expression that should return "True" if the passed node matches criteria.<br />
<br />
@return <<a href="#AdvancedTag" >AdvancedTag</a>/None> - First match, or None<br />
<br />
<br />
@see getFirstElementCustomFilter for matches against children</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getPeers" ><strong >getPeers</strong></a>(self)</dt><dd ><tt >getPeers - Get elements who share a parent with this element<br />
<br />
@return - <a href="#TagCollection" >TagCollection</a> of elements</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getPeersByAttr" ><strong >getPeersByAttr</strong></a>(self, attrName, attrValue)</dt><dd ><tt >getPeersByAttr - Gets peers (elements on same level) which match an attribute/value combination.<br />
<br />
@param attrName - Name of attribute<br />
@param attrValue - Value that must match<br />
<br />
@return - None if no parent element (error condition), otherwise a <a href="#TagCollection" >TagCollection</a> of peers that matched.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getPeersByClassName" ><strong >getPeersByClassName</strong></a>(self, className)</dt><dd ><tt >getPeersByClassName - Gets peers (elements on same level) with a given class name<br />
<br />
@param className - classname must contain this name<br />
<br />
@return - None if no parent element (error condition), otherwise a <a href="#TagCollection" >TagCollection</a> of peers that matched.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getPeersByName" ><strong >getPeersByName</strong></a>(self, name)</dt><dd ><tt >getPeersByName - Gets peers (elements on same level) with a given name<br />
<br />
@param name - Name to match<br />
<br />
@return - None if no parent element (error condition), otherwise a <a href="#TagCollection" >TagCollection</a> of peers that matched.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getPeersCustomFilter" ><strong >getPeersCustomFilter</strong></a>(self, filterFunc)</dt><dd ><tt >getPeersCustomFilter - Get elements who share a parent with this element and also pass a custom filter check<br />
<br />
@param filterFunc <lambda/function> - Passed in an element, and returns True if it should be treated as a match, otherwise False.<br />
<br />
@return <<a href="#TagCollection" >TagCollection</a>> - Resulting peers, or None if no parent node.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getPeersWithAttrValues" ><strong >getPeersWithAttrValues</strong></a>(self, attrName, attrValues)</dt><dd ><tt >getPeersWithAttrValues - Gets peers (elements on same level) whose attribute given by #attrName<br />
are in the <a href="__builtin__.html#list" >list</a> of possible vaues #attrValues<br />
<br />
@param attrName - Name of attribute<br />
@param attrValues - List of possible values which will match<br />
<br />
@return - None if no parent element (error condition), otherwise a <a href="#TagCollection" >TagCollection</a> of peers that matched.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getStartTag" ><strong >getStartTag</strong></a>(self)</dt><dd ><tt >getStartTag - Returns the start tag represented as HTML<br />
<br />
@return - String of start tag with attributes</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getStyle" ><strong >getStyle</strong></a>(self, styleName)</dt><dd ><tt >getStyle - Gets the value of a style paramater, part of the "style" attribute<br />
<br />
@param styleName - The name of the style<br />
<br />
@return - String of the value of the style. '' is no value.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getStyleDict" ><strong >getStyleDict</strong></a>(self)</dt><dd ><tt >getStyleDict - Gets a dictionary of style attribute/value pairs.<br />
<br />
@return - OrderedDict of "style" attribute.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getTagName" ><strong >getTagName</strong></a>(self)</dt><dd ><tt >getTagName - Gets the tag name of this Tag (lowercase).<br />
<br />
@return - str - name of tag</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-getUid" ><strong >getUid</strong></a>(self)</dt><dd ><tt >getUid - Get the AdvancedHTMLParser unique id for this tag.<br />
<br />
Each tag is given a generated uuid at create time, and copies also get their own unique identifier.<br />
<br />
This can be used to determine if two tags are the same tag, beyond just having equal attribute name/value pairs and children.<br />
<br />
This is used internally to prevent duplicates, for example a <a href="#TagCollection" >TagCollection</a> does not allow multiple tags with the same uid<br />
<br />
@return - uuid.UUID <a href="__builtin__.html#object" >object</a>, representing a uuid as specified by <a href="http://www.rfc-editor.org/rfc/rfc4122.txt" >RFC 4122</a>, version 4.<br />
This <a href="__builtin__.html#object" >object</a> is optimized for comparison. For a string representation, str() the result, or use .hex or .variant</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-hasAttribute" ><strong >hasAttribute</strong></a>(self, attrName)</dt><dd ><tt >hasAttribute - Checks for the existance of an attribute. Attribute names are all lowercase.<br />
<br />
@param attrName <str> - The attribute name<br />
<br />
@return <bool> - True or False if attribute exists by that name</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-hasChild" ><strong >hasChild</strong></a>(self, child)</dt><dd ><tt >hasChild - Returns if #child is a DIRECT child (tag) of this node.<br />
<br />
@param child <<a href="#AdvancedTag" >AdvancedTag</a>> - The tag to check<br />
<br />
@return <bool> - If #child is a direct child of this node, True. Otherwise, False.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-hasChildNodes" ><strong >hasChildNodes</strong></a>(self)</dt><dd ><tt >hasChildNodes - Checks if this node has any children (tags).<br />
<br />
@return <bool> - True if this child has any children, otherwise False.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-hasClass" ><strong >hasClass</strong></a>(self, className)</dt><dd ><tt >hasClass - Test if this tag has a paticular class name ( class attribute )<br />
<br />
@param className - A class to search<br />
<br />
@return <bool> - True if provided class is present, otherwise False</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-insertAfter" ><strong >insertAfter</strong></a>(self, child, afterChild)</dt><dd ><tt >insertAfter - Inserts a child after #afterChild<br />
<br />
<br />
@param child <<a href="#AdvancedTag" >AdvancedTag</a>/str> - Child block to insert<br />
<br />
@param afterChild <<a href="#AdvancedTag" >AdvancedTag</a>/str> - Child block to insert after. if None, will be appended<br />
<br />
@return - The added child. Note, if it is a text block (str), the return isl NOT be linked by reference.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-insertBefore" ><strong >insertBefore</strong></a>(self, child, beforeChild)</dt><dd ><tt >insertBefore - Inserts a child before #beforeChild<br />
<br />
<br />
@param child <<a href="#AdvancedTag" >AdvancedTag</a>/str> - Child block to insert<br />
<br />
@param beforeChild <<a href="#AdvancedTag" >AdvancedTag</a>/str> - Child block to insert before. if None, will be appended<br />
<br />
@return - The added child. Note, if it is a text block (str), the return isl NOT be linked by reference.<br />
<br />
@raises ValueError - If #beforeChild is defined and is not a child of this node</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-isEqualNode" ><strong >isEqualNode</strong></a> = <a href="#AdvancedTag-__eq__" >__eq__</a>(self, other)</dt></dl>
<dl ><dt ><a name="AdvancedTag-isTagEqual" ><strong >isTagEqual</strong></a>(self, other)</dt><dd ><tt >isTagEqual - Compare if a tag contains the same tag name and attributes as another tag,<br />
<br />
i.e. if everything between < and > parts of this tag are the same.<br />
<br />
Does NOT compare children, etc. Does NOT compare if these are the same exact tag in the html (use regular == operator for that)<br />
<br />
So for example:<br />
<br />
tag1 = document.<a href="#AdvancedTag-getElementById" >getElementById</a>('something')<br />
tag2 = copy.copy(tag1)<br />
<br />
tag1 == tag2 # This is False<br />
tag1.<a href="#AdvancedTag-isTagEqual" >isTagEqual</a>(tag2) # This is True<br />
<br />
@return bool - True if tags have the same name and attributes, otherwise False</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-remove" ><strong >remove</strong></a>(self)</dt><dd ><tt >remove - Will remove this node from its parent, if it has a parent (thus taking it out of the HTML tree)<br />
<br />
NOTE: If you are using an IndexedAdvancedHTMLParser, calling this will NOT update the index. You MUST call<br />
reindex method manually.<br />
<br />
@return <bool> - While JS DOM defines no return for this function, this function will return True if a<br />
remove did happen, or False if no parent was set.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-removeAttribute" ><strong >removeAttribute</strong></a>(self, attrName)</dt><dd ><tt >removeAttribute - Removes an attribute, by name.<br />
<br />
@param attrName <str> - The attribute name</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-removeBlock" ><strong >removeBlock</strong></a>(self, block)</dt><dd ><tt >removeBlock - Removes a single block (text node or <a href="#AdvancedTag" >AdvancedTag</a>) which is a child of this <a href="__builtin__.html#object" >object</a>.<br />
<br />
@param block <str/<a href="#AdvancedTag" >AdvancedTag</a>> - The block (text node or <a href="#AdvancedTag" >AdvancedTag</a>) to remove.<br />
<br />
@return Returns the removed block if one was removed, or None if requested block is not a child of this node.<br />
<br />
NOTE: If you know you are going to remove an <a href="#AdvancedTag" >AdvancedTag</a>, @see removeChild<br />
If you know you are going to remove a text node, @see removeText<br />
<br />
If removing multiple blocks, @see removeBlocks</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-removeBlocks" ><strong >removeBlocks</strong></a>(self, blocks)</dt><dd ><tt >removeBlock - Removes a <a href="__builtin__.html#list" >list</a> of blocks (the first occurance of each) from the direct children of this node.<br />
<br />
@param blocks <a href="__builtin__.html#list" >list</a><str/<a href="#AdvancedTag" >AdvancedTag</a>> - List of AdvancedTags for tag nodes, else strings for text nodes<br />
<br />
@return The removed blocks in each slot, or None if None removed.<br />
<br />
@see removeChild<br />
@see removeText<br />
<br />
For multiple, @see removeBlocks</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-removeChild" ><strong >removeChild</strong></a>(self, child)</dt><dd ><tt >removeChild - Remove a child tag, if present.<br />
<br />
@param child <<a href="#AdvancedTag" >AdvancedTag</a>> - The child to remove<br />
<br />
@return - The child [with parentNode cleared] if removed, otherwise None.<br />
<br />
NOTE: This removes a tag. If removing a text block, use #removeText function.<br />
If you need to remove an arbitrary block (text or <a href="#AdvancedTag" >AdvancedTag</a>), @see removeBlock<br />
<br />
Removing multiple children? @see removeChildren</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-removeChildren" ><strong >removeChildren</strong></a>(self, children)</dt><dd ><tt >removeChildren - Remove multiple child AdvancedTags.<br />
<br />
@see removeChild<br />
<br />
@return <a href="__builtin__.html#list" >list</a><<a href="#AdvancedTag" >AdvancedTag</a>/None> - A <a href="__builtin__.html#list" >list</a> of all tags removed in same order as passed.<br />
Item is "None" if it was not attached to this node, and thus was not removed.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-removeClass" ><strong >removeClass</strong></a>(self, className)</dt><dd ><tt >removeClass - remove a class name if present. Returns the class name if removed, otherwise None.<br />
<br />
@param className <str> - The name of the class to remove<br />
<br />
@return <str> - The class name removed if one was removed, otherwise None if #className wasn't present</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-removeNode" ><strong >removeNode</strong></a> = <a href="#AdvancedTag-removeChild" >removeChild</a>(self, child)</dt></dl>
<dl ><dt ><a name="AdvancedTag-removeText" ><strong >removeText</strong></a>(self, text)</dt><dd ><tt >removeText - Removes the first occurace of given text in a text node (i.e. not part of a tag)<br />
<br />
@param text <str> - text to remove<br />
<br />
@return text <str/None> - The text in that block (text node) after remove, or None if not found<br />
<br />
NOTE: To remove a node, @see removeChild<br />
NOTE: To remove a block (maybe a node, maybe text), @see removeBlock<br />
NOTE: To remove ALL occuraces of text, @see removeTextAll</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-removeTextAll" ><strong >removeTextAll</strong></a>(self, text)</dt><dd ><tt >removeTextAll - Removes ALL occuraces of given text in a text node (i.e. not part of a tag)<br />
<br />
@param text <str> - text to remove<br />
<br />
@return <a href="__builtin__.html#list" >list</a> <str> - All text node containing #text BEFORE the text was removed.<br />
Empty <a href="__builtin__.html#list" >list</a> if no text removed<br />
<br />
NOTE: To remove a node, @see removeChild<br />
NOTE: To remove a block (maybe a node, maybe text), @see removeBlock<br />
NOTE: To remove a single occurace of text, @see removeText</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-setAttribute" ><strong >setAttribute</strong></a>(self, attrName, attrValue)</dt><dd ><tt >setAttribute - Sets an attribute. Be wary using this for classname, maybe use addClass/removeClass. Attribute names are all lowercase.<br />
<br />
@param attrName <str> - The name of the attribute<br />
<br />
@param attrValue <str> - The value of the attribute<br />
<br />
<br />
@raises -<br />
<br />
KeyError if #attrName is invalid name for an attribute</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-setAttributes" ><strong >setAttributes</strong></a>(self, attributesDict)</dt><dd ><tt >setAttributes - Sets several attributes at once, using a dictionary of attrName : attrValue<br />
<br />
@param attributesDict - <str:str> - New attribute names -> values<br />
<br />
@raises -</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-setStyle" ><strong >setStyle</strong></a>(self, styleName, styleValue)</dt><dd ><tt >setStyle - Sets a style param. Example: "display", "block"<br />
<br />
If you need to set many styles on an element, use setStyles instead.<br />
It takes a dictionary of attribute, value pairs and applies it all in one go (faster)<br />
<br />
To remove a style, set its value to empty string.<br />
When all styles are removed, the "style" attribute will be nullified.<br />
<br />
@param styleName - The name of the style element<br />
@param styleValue - The value of which to assign the style element<br />
<br />
@return - String of current value of "style" after change is made.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-setStyles" ><strong >setStyles</strong></a>(self, styleUpdatesDict)</dt><dd ><tt >setStyles - Sets one or more style params.<br />
This all happens in one shot, so it is much much faster than calling setStyle for every value.<br />
<br />
To remove a style, set its value to empty string.<br />
When all styles are removed, the "style" attribute will be nullified.<br />
<br />
@param styleUpdatesDict - Dictionary of attribute : value styles.<br />
<br />
@return - String of current value of "style" after change is made.</tt></dd></dl>
<dl ><dt ><a name="AdvancedTag-toHTML" ><strong >toHTML</strong></a>(self)</dt><dd ><tt >toHTML - Get the HTML representation of this tag and all children<br />
<br />
@return <str> - HTML with this tag as the root</tt></dd></dl>
<hr />
Data descriptors defined here:<br />
<dl ><dt ><strong >__dict__</strong></dt>
<dd ><tt >dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl ><dt ><strong >__weakref__</strong></dt>
<dd ><tt >list of weak references to the object (if defined)</tt></dd>
</dl>
<dl ><dt ><strong >attributes</strong></dt>
<dd ><tt >attributesDict - Returns the internal dict mapped to attributes on this object.<br />
<br />
Modifications made here WILL affect this tag, use getAttributesDict to get a copy.<br />
<br />
This is the default provider of the "attributes" property. Can be toggled to use the DOM-matching version, see @toggleAttributesDOM<br />
<br />
@return <dict> - Internal attributes</tt></dd>
</dl>
<dl ><dt ><strong >attributesDOM</strong></dt>
<dd ><tt >attributes - Return a NamedNodeMap of the attributes on this object.<br />
<br />
This is a horrible method and is not used in practice anywhere sane.<br />
<br />
Please use setAttribute, getAttribute, hasAttribute methods instead.<br />
<br />
@see SpecialAttributes.NamedNodeMap<br />
<br />
This is NOT the default provider of the "attributes" property. Can be toggled to use the DOM-matching version, see @toggleAttributesDOM<br />
<br />
@return AttributeNodeMap</tt></dd>
</dl>
<dl ><dt ><strong >attributesDict</strong></dt>
<dd ><tt >attributesDict - Returns the internal dict mapped to attributes on this object.<br />
<br />
Modifications made here WILL affect this tag, use getAttributesDict to get a copy.<br />
<br />
This is the default provider of the "attributes" property. Can be toggled to use the DOM-matching version, see @toggleAttributesDOM<br />
<br />
@return <dict> - Internal attributes</tt></dd>
</dl>
<dl ><dt ><strong >attributesList</strong></dt>
<dd ><tt >attributesList - Returns a copy of internal attributes as a list. Same as getAttributesList method.<br />
<br />
@return list<tuple> - List of (key, value) tuples representing each attribute on this node<br />
<br />
<br />
@see getAttributesList<br />
@see attributesDict</tt></dd>
</dl>
<dl ><dt ><strong >childBlocks</strong></dt>
<dd ><tt >childBlocks - Return immediate child blocks, both text and tags.<br />
<br />
@return list<AdvancedTag/str> - List of blocks associated with this node<br />
<br />
NOTE: This does what #childNodes does in JS DOM. Because for many years childNodes has returned<br />
ONLY tags on AdvancedHTMLParser, it would be a major change to match. Likely will be made in a future<br />
version.</tt></dd>
</dl>
<dl ><dt ><strong >childElementCount</strong></dt>
<dd ><tt >childElementCount - Returns the number of direct children to this node<br />
<br />
@return <int> - The number of direct children to this node</tt></dd>
</dl>
<dl ><dt ><strong >childNodes</strong></dt>
<dd ><tt >childNodes - returns immediate child nodes as a TagCollection<br />
<br />
@return - TagCollection of child nodes<br />
<br />
NOTE: Unlike JS DOM, this returns ONLY tags, not text blocks.<br />
Changing this would be a fairly-major backwards-incompatible change,<br />
and will likely be made in a future version.<br />
<br />
For now, use @see childBlocks method to get both text AND tags</tt></dd>
</dl>
<dl ><dt ><strong >classList</strong></dt>
<dd ><tt >classList - get a copy of the list of the class names ( the "class" attribute ) for this element<br />
<br />
@return DOMTokenList<str> - A list of the class names for this element</tt></dd>
</dl>
<dl ><dt ><strong >className</strong></dt>
<dd ><tt >className - property, string of 'class' attribute<br />
<br />
@return <str> - Class attribute, or empty string if not set</tt></dd>
</dl>
<dl ><dt ><strong >classNames</strong></dt>
<dd ><tt >classList - get a copy of the list of the class names ( the "class" attribute ) for this element<br />
<br />
@return DOMTokenList<str> - A list of the class names for this element</tt></dd>
</dl>
<dl ><dt ><strong >firstChild</strong></dt>
<dd ><tt >firstChild - property, Get the first child block, text or tag.<br />
<br />
@return <str/AdvancedTag/None> - The first child block, or None if no child blocks</tt></dd>
</dl>
<dl ><dt ><strong >firstElementChild</strong></dt>
<dd ><tt >firstElementChild - property, Get the first child which is an element (AdvancedTag)<br />
<br />
@return <AdvancedTag/None> - The first element child, or None if no element child nodes</tt></dd>
</dl>
<dl ><dt ><strong >innerHTML</strong></dt>
<dd ><tt >innerHTML - Returns an HTML string of the inner contents of this tag, including children.<br />
<br />
@return - String of inner contents HTML</tt></dd>
</dl>
<dl ><dt ><strong >innerText</strong></dt>
<dd ><tt >innerText - property, gets the text of just this node. Use #textContent for this node and all children<br />
<br />
This is an alias of the .text property<br />
<br />
@return <str> - The text of this node</tt></dd>
</dl>
<dl ><dt ><strong >lastChild</strong></dt>
<dd ><tt >lastChild - property, Get the last child block, text or tag<br />
<br />
@return <str/AdvancedTag/None> - The last child block, or None if no child blocks</tt></dd>
</dl>
<dl ><dt ><strong >lastElementChild</strong></dt>
<dd ><tt >lastElementChild - property, Get the last child which is an element (AdvancedTag)<br />
<br />
@return <AdvancedTag/None> - The last element child, or None if no element child nodes</tt></dd>
</dl>
<dl ><dt ><strong >nextElementSibling</strong></dt>
<dd ><tt >nextElementSibling - Returns the next sibling that is an element.<br />
This is the tag node following this node in the parent's list of children<br />
<br />
@return <None/AdvancedTag> - None if there are no children (tag) in the parent after this node,<br />
Otherwise the following element (tag)</tt></dd>
</dl>
<dl ><dt ><strong >nextSibling</strong></dt>
<dd ><tt >nextSibling - Returns the next sibling. This is the child following this node in the parent's list of children.<br />
<br />
This could be text or an element. use nextSiblingElement to ensure element<br />
<br />
@return <None/str/AdvancedTag> - None if there are no nodes (text or tag) in the parent after this node,<br />
Otherwise the following node (text or tag)</tt></dd>
</dl>
<dl ><dt ><strong >nextSiblingElement</strong></dt>
<dd ><tt >nextElementSibling - Returns the next sibling that is an element.<br />
This is the tag node following this node in the parent's list of children<br />
<br />
@return <None/AdvancedTag> - None if there are no children (tag) in the parent after this node,<br />
Otherwise the following element (tag)</tt></dd>
</dl>
<dl ><dt ><strong >nodeName</strong></dt>
<dd ><tt >nodeName - Return the name of this name (tag name)</tt></dd>
</dl>
<dl ><dt ><strong >nodeType</strong></dt>
<dd ><tt >nodeType - Return the type of this node (1 - ELEMENT_NODE)</tt></dd>
</dl>
<dl ><dt ><strong >nodeValue</strong></dt>
<dd ><tt >nodeValue - Return the value of this node (None)</tt></dd>
</dl>
<dl ><dt ><strong >outerHTML</strong></dt>
<dd ><tt >outerHTML - Returns start tag, innerHTML, and end tag as HTML string<br />
<br />
@return - String of start tag, innerHTML, and end tag</tt></dd>
</dl>
<dl ><dt ><strong >parentElement</strong></dt>
<dd ><tt >parentElement - get the parent element of this node<br />
<br />
@return <AdvancedTag/None> - The parent node, or None if no parent</tt></dd>
</dl>
<dl ><dt ><strong >peers</strong></dt>
<dd ><tt >peers - Get elements with same parent as this item<br />
<br />
@return - TagCollection of elements</tt></dd>
</dl>
<dl ><dt ><strong >previousElementSibling</strong></dt>
<dd ><tt >previousElementSibling - Returns the previous sibling that is an element.<br />
<br />
This is the previous tag node in the parent's list of children<br />
<br />
<br />
@return <None/AdvancedTag> - None if there are no children (tag) in the parent before this node,<br />
Otherwise the previous element (tag)</tt></dd>
</dl>
<dl ><dt ><strong >previousSibling</strong></dt>
<dd ><tt >previousSibling - Returns the previous sibling. This would be the previous node (text or tag) in the parent's list<br />
<br />
This could be text or an element. use previousSiblingElement to ensure element<br />
<br />
<br />
@return <None/str/AdvancedTag> - None if there are no nodes (text or tag) in the parent before this node,<br />
Otherwise the previous node (text or tag)</tt></dd>
</dl>
<dl ><dt ><strong >previousSiblingElement</strong></dt>
<dd ><tt >previousElementSibling - Returns the previous sibling that is an element.<br />
<br />
This is the previous tag node in the parent's list of children<br />
<br />
<br />
@return <None/AdvancedTag> - None if there are no children (tag) in the parent before this node,<br />
Otherwise the previous element (tag)</tt></dd>
</dl>
<dl ><dt ><strong >tagBlocks</strong></dt>
<dd ><tt >tagBlocks - Property.<br />
Returns all the blocks which are direct children of this node, where that block is a tag (not text)<br />
<br />
NOTE: This is similar to .children , and you should probably use .children instead except within this class itself<br />
<br />
@return list<AdvancedTag> - A list of direct children which are tags.</tt></dd>
</dl>
<dl ><dt ><strong >textBlocks</strong></dt>
<dd ><tt >textBlocks - Property.<br />
Returns all the blocks which are direct children of this node, where that block is a text (not a tag)<br />
<br />
@return list<AdvancedTag> - A list of direct children which are text.</tt></dd>
</dl>
<dl ><dt ><strong >textContent</strong></dt>
<dd ><tt >textContent - property, gets the text of this node and all inner nodes.<br />
<br />
Use .innerText for just this node's text<br />
<br />
@return <str> - The text of all nodes at this level or lower</tt></dd>
</dl>
</td></tr></table> <p >
<table cellpadding="2" width="100%" border="0" cellspacing="0" summary="section" >
<tr bgcolor="#ffc8d8" >
<td colspan="3" valign="bottom" > <br />
<font color="#000000" face="helvetica, arial" ><a name="FilterableTagCollection" >class <strong >FilterableTagCollection</strong></a>(<a href="QueryableList.Base.html#QueryableListBase" >QueryableList.Base.QueryableListBase</a>)</font></td></tr>
<tr ><td bgcolor="#ffc8d8" ><tt > </tt></td><td > </td>
<td width="100%" ><dl ><dt >Method resolution order:</dt>
<dd ><a href="AdvancedHTMLParser.Tags.html#FilterableTagCollection" >FilterableTagCollection</a></dd>
<dd ><a href="QueryableList.Base.html#QueryableListBase" >QueryableList.Base.QueryableListBase</a></dd>
<dd ><a href="__builtin__.html#list" >__builtin__.list</a></dd>
<dd ><a href="__builtin__.html#object" >__builtin__.object</a></dd>
</dl>
<hr />
Methods defined here:<br />
<dl ><dt ><a name="FilterableTagCollection-filter" ><strong >filter</strong></a> = <a href="#FilterableTagCollection-filterAnd" >filterAnd</a>(self, **kwargs)</dt></dl>
<dl ><dt ><a name="FilterableTagCollection-filterAnd" ><strong >filterAnd</strong></a>(self, **kwargs)</dt></dl>
<dl ><dt ><a name="FilterableTagCollection-filterOr" ><strong >filterOr</strong></a>(self, **kwargs)</dt></dl>
<hr />
Methods inherited from <a href="QueryableList.Base.html#QueryableListBase" >QueryableList.Base.QueryableListBase</a>:<br />
<dl ><dt ><a name="FilterableTagCollection-__add__" ><strong >__add__</strong></a>(self, other)</dt><dd ><tt >__add__ - Append all items in #other to the tail of #self<br />
<br />
+ operator<br />
<br />
Returns a copy, does not modify this item.</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__and__" ><strong >__and__</strong></a>(self, other)</dt><dd ><tt >__and__ - Return a QueryableList (of this type) which contains all the elements in #self that are also in #other<br />
<br />
Returns a copy</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__copy__" ><strong >__copy__</strong></a>(self)</dt><dd ><tt >__copy__ - Make a copy of this collection</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__getslice__" ><strong >__getslice__</strong></a>(self, start, end)</dt><dd ><tt >__getslice__ - Return a "slice" (subset) of the current collection.<br />
<br />
Returns a copy</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__iadd__" ><strong >__iadd__</strong></a>(self, other)</dt><dd ><tt >__iadd__ - Append all items in #other to the tail of #self<br />
<br />
+= operator<br />
<br />
Modifies original</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__iand__" ><strong >__iand__</strong></a>(self, other)</dt></dl>
<dl ><dt ><a name="FilterableTagCollection-__ior__" ><strong >__ior__</strong></a>(self, other)</dt></dl>
<dl ><dt ><a name="FilterableTagCollection-__isub__" ><strong >__isub__</strong></a>(self, other)</dt><dd ><tt >__isub__ - Implement subtract-equals. Removes any items from #self that are present in #other<br />
<br />
Works inline and modifies #self</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__ixor__" ><strong >__ixor__</strong></a>(self, other)</dt></dl>
<dl ><dt ><a name="FilterableTagCollection-__or__" ><strong >__or__</strong></a>(self, other)</dt><dd ><tt >__or__ - Append any items found in #other which are not already present in #self<br />
<br />
Returns a copy</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__repr__" ><strong >__repr__</strong></a>(self)</dt><dd ><tt >__repr__ - Return a code representation of this class</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__sub__" ><strong >__sub__</strong></a>(self, other)</dt><dd ><tt >__sub__ - Implement subtract. Removes any items from #self that are present in #other<br />
<br />
Returns a copy, does not modify inline</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__xor__" ><strong >__xor__</strong></a>(self, other)</dt><dd ><tt >__xor__ - Return a QueryableList (of this type) which contains all the elements<br />
that appear in either #self or #other, but not both.<br />
<br />
Returns a copy</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-all" ><strong >all</strong></a>(self)</dt><dd ><tt >all - Returns all items in this collection, as the collection type (aka returns a copy of "self").<br />
<br />
This method is provided for method parity with ORMs that build a filter set with filter calls,<br />
and then execute with ".all" (like django or IndexedRedis).<br />
<br />
That way you can filter and call ".<a href="#FilterableTagCollection-all" >all</a>()" after, and it doesn't matter if you're hitting the db<br />
or filtering already-fetched objects, the usage remains the same.<br />
<br />
@return <self.<strong >__class__</strong>> - self</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-count" ><strong >count</strong></a>(self)</dt><dd ><tt >count - Returns the number of items in this collection.<br />
<br />
This is the same as len(...), but is added to be compatible with many server-side ORMs which implement "count" as a function.<br />
<br />
@return <int> - Number of items in this collection</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-customFilter" ><strong >customFilter</strong></a>(self, filterFunc)</dt><dd ><tt >customFilter - Apply a custom filter to elements and return a QueryableList of matches<br />
<br />
@param filterFunc <lambda/function< - A lambda/function that is passed an item, and<br />
returns True if the item matches (will be returned), otherwise False.<br />
<br />
@return - A QueryableList <a href="__builtin__.html#object" >object</a> of the same type, with only the matching objects returned.</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-sort_by" ><strong >sort_by</strong></a>(self, fieldName, reverse<font color="#909090" >=False</font>)</dt><dd ><tt >sort_by - Return a copy of this collection, sorted by the given fieldName.<br />
<br />
The fieldName is accessed the same way as other filtering, so it supports custom properties, etc.<br />
<br />
@param fieldName <str> - The name of the field on which to sort by<br />
<br />
@param reverse <bool> Default False - If True, <a href="__builtin__.html#list" >list</a> will be in reverse order.<br />
<br />
@return <QueryableList> - A QueryableList of the same type with the elements sorted based on arguments.</tt></dd></dl>
<hr />
Data descriptors inherited from <a href="QueryableList.Base.html#QueryableListBase" >QueryableList.Base.QueryableListBase</a>:<br />
<dl ><dt ><strong >__dict__</strong></dt>
<dd ><tt >dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl ><dt ><strong >__weakref__</strong></dt>
<dd ><tt >list of weak references to the object (if defined)</tt></dd>
</dl>
<hr />
Methods inherited from <a href="__builtin__.html#list" >__builtin__.list</a>:<br />
<dl ><dt ><a name="FilterableTagCollection-__contains__" ><strong >__contains__</strong></a>(...)</dt><dd ><tt >x.<a href="#FilterableTagCollection-__contains__" >__contains__</a>(y) <==> y in x</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__delitem__" ><strong >__delitem__</strong></a>(...)</dt><dd ><tt >x.<a href="#FilterableTagCollection-__delitem__" >__delitem__</a>(y) <==> del x[y]</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__delslice__" ><strong >__delslice__</strong></a>(...)</dt><dd ><tt >x.<a href="#FilterableTagCollection-__delslice__" >__delslice__</a>(i, j) <==> del x[i:j]<br />
<br />
Use of negative indices is not supported.</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__eq__" ><strong >__eq__</strong></a>(...)</dt><dd ><tt >x.<a href="#FilterableTagCollection-__eq__" >__eq__</a>(y) <==> x==y</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__ge__" ><strong >__ge__</strong></a>(...)</dt><dd ><tt >x.<a href="#FilterableTagCollection-__ge__" >__ge__</a>(y) <==> x>=y</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__getattribute__" ><strong >__getattribute__</strong></a>(...)</dt><dd ><tt >x.<a href="#FilterableTagCollection-__getattribute__" >__getattribute__</a>('name') <==> x.name</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__getitem__" ><strong >__getitem__</strong></a>(...)</dt><dd ><tt >x.<a href="#FilterableTagCollection-__getitem__" >__getitem__</a>(y) <==> x[y]</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__gt__" ><strong >__gt__</strong></a>(...)</dt><dd ><tt >x.<a href="#FilterableTagCollection-__gt__" >__gt__</a>(y) <==> x>y</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__imul__" ><strong >__imul__</strong></a>(...)</dt><dd ><tt >x.<a href="#FilterableTagCollection-__imul__" >__imul__</a>(y) <==> x*=y</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__init__" ><strong >__init__</strong></a>(...)</dt><dd ><tt >x.<a href="#FilterableTagCollection-__init__" >__init__</a>(...) initializes x; see help(type(x)) for signature</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__iter__" ><strong >__iter__</strong></a>(...)</dt><dd ><tt >x.<a href="#FilterableTagCollection-__iter__" >__iter__</a>() <==> iter(x)</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__le__" ><strong >__le__</strong></a>(...)</dt><dd ><tt >x.<a href="#FilterableTagCollection-__le__" >__le__</a>(y) <==> x<=y</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__len__" ><strong >__len__</strong></a>(...)</dt><dd ><tt >x.<a href="#FilterableTagCollection-__len__" >__len__</a>() <==> len(x)</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__lt__" ><strong >__lt__</strong></a>(...)</dt><dd ><tt >x.<a href="#FilterableTagCollection-__lt__" >__lt__</a>(y) <==> x<y</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__mul__" ><strong >__mul__</strong></a>(...)</dt><dd ><tt >x.<a href="#FilterableTagCollection-__mul__" >__mul__</a>(n) <==> x*n</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__ne__" ><strong >__ne__</strong></a>(...)</dt><dd ><tt >x.<a href="#FilterableTagCollection-__ne__" >__ne__</a>(y) <==> x!=y</tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__reversed__" ><strong >__reversed__</strong></a>(...)</dt><dd ><tt >L.<a href="#FilterableTagCollection-__reversed__" >__reversed__</a>() -- return a reverse iterator over the <a href="__builtin__.html#list" >list</a></tt></dd></dl>
<dl ><dt ><a name="FilterableTagCollection-__rmul__" ><strong >__rmul__</strong></a>(...)</dt><dd ><tt >x.<a href="#FilterableTagCollection-__rmul__" >__rmul__</a>(n) <==> n*x</tt></dd></dl>