.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .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. \*(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- .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" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "XML::Compile::Iterator 3pm" .TH XML::Compile::Iterator 3pm "2022-11-27" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" XML::Compile::Iterator \- reduce view on a node tree .SH "SYNOPSIS" .IX Header "SYNOPSIS" .SH "DESCRIPTION" .IX Header "DESCRIPTION" It would have been nice to be able to use XML::LibXML::Iterator, but on the moment of this writing, that module is not maintained. Besides, this implementation of the iterator is more specific for our purpose. The main user for this object currently is XML::Compile::Translate. .SH "METHODS" .IX Header "METHODS" .SS "Constructors" .IX Subsection "Constructors" .ie n .IP "$obj\->\fBdescend\fR( [$node, [$path, [$filter]]] )" 4 .el .IP "\f(CW$obj\fR\->\fBdescend\fR( [$node, [$path, [$filter]]] )" 4 .IX Item "$obj->descend( [$node, [$path, [$filter]]] )" The \f(CW$node\fR is a child of the node handled by the iterator where this method is called upon. Without explicit \f(CW$node\fR, the current node is used. Returned is a new XML::Compile::Iterator object. The new iterator will use the same \f(CW$filter\fR as the parent iterator by default. The internal administered path with be extended with the \f(CW$path\fR. .ie n .IP "XML::Compile::Iterator\->\fBnew\fR($node, $path, $filter,)" 4 .el .IP "XML::Compile::Iterator\->\fBnew\fR($node, \f(CW$path\fR, \f(CW$filter\fR,)" 4 .IX Item "XML::Compile::Iterator->new($node, $path, $filter,)" The \f(CW$node\fR is a XML::LibXML::Node object, of which the direct children are inspected. .Sp The \f(CW$filter\fR a \s-1CODE\s0 reference which is called for each child node. The only parameter is the parent \f(CW$node\fR, and then it must return either true or false. In case of true, the node is selected. The \s-1FILTERS\s0 is applied to all children of the \f(CW$node\fR once, when the first child is requested by the program. .SS "Attributes" .IX Subsection "Attributes" .ie n .IP "$obj\->\fBfilter\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBfilter\fR()" 4 .IX Item "$obj->filter()" Returns the \s-1CODE\s0 reference which is used to select the nodes. .ie n .IP "$obj\->\fBnode\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBnode\fR()" 4 .IX Item "$obj->node()" Returns the XML::LibXML::Node node of which the children are walked through. .ie n .IP "$obj\->\fBpath\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBpath\fR()" 4 .IX Item "$obj->path()" The path represents the location where the node is, like a symbolic link, how you got there. .SS "Scanning" .IX Subsection "Scanning" .ie n .IP "$obj\->\fBchilds\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBchilds\fR()" 4 .IX Item "$obj->childs()" Returns the child nodes which fulfil the filter requirements. In \s-1LIST\s0 context as list, in \s-1SCALAR\s0 context as reference to an \s-1ARRAY.\s0 .ie n .IP "$obj\->\fBcurrentChild\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBcurrentChild\fR()" 4 .IX Item "$obj->currentChild()" Returns the current child node. .ie n .IP "$obj\->\fBfirstChild\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBfirstChild\fR()" 4 .IX Item "$obj->firstChild()" Returns the first child node. Does not change the current position. .ie n .IP "$obj\->\fBlastChild\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBlastChild\fR()" 4 .IX Item "$obj->lastChild()" Returns the last child node which fulfills the requirements. Does not change the current position. .ie n .IP "$obj\->\fBnextChild\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBnextChild\fR()" 4 .IX Item "$obj->nextChild()" Returns the next child when available, otherwise \f(CW\*(C`undef\*(C'\fR. .ie n .IP "$obj\->\fBnrChildren\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBnrChildren\fR()" 4 .IX Item "$obj->nrChildren()" Returns the number of childnodes which fulfill the restriction. .ie n .IP "$obj\->\fBpreviousChild\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBpreviousChild\fR()" 4 .IX Item "$obj->previousChild()" Returns the previous child when available, otherwise \f(CW\*(C`undef\*(C'\fR. .SS "simplify \s-1XML\s0 node access" .IX Subsection "simplify XML node access" .ie n .IP "$obj\->\fBcurrentContent\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBcurrentContent\fR()" 4 .IX Item "$obj->currentContent()" Returns the textContent of the \fBcurrentChild()\fR node, or undef. .ie n .IP "$obj\->\fBcurrentLocal\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBcurrentLocal\fR()" 4 .IX Item "$obj->currentLocal()" Returns the local name of the \fBcurrentChild()\fR, or the empty string. .ie n .IP "$obj\->\fBcurrentType\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBcurrentType\fR()" 4 .IX Item "$obj->currentType()" Returns the type of the \fBcurrentChild()\fR, or the empty string. .ie n .IP "$obj\->\fBnodeLocal\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBnodeLocal\fR()" 4 .IX Item "$obj->nodeLocal()" Returns the local name of the \fBnode()\fR, or the empty string. .ie n .IP "$obj\->\fBnodeNil\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBnodeNil\fR()" 4 .IX Item "$obj->nodeNil()" Returns true if the current node has \f(CW\*(C`xsi:type="true"\*(C'\fR. .ie n .IP "$obj\->\fBnodeType\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBnodeType\fR()" 4 .IX Item "$obj->nodeType()" Returns the type of the \fBnode()\fR, or the empty string. .ie n .IP "$obj\->\fBtextContent\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBtextContent\fR()" 4 .IX Item "$obj->textContent()" Returns the textContent of the \fBnode()\fR, or undef. .SH "SEE ALSO" .IX Header "SEE ALSO" This module is part of XML-Compile distribution version 1.63, built on July 02, 2019. Website: \fIhttp://perl.overmeer.net/xml\-compile/\fR .SH "LICENSE" .IX Header "LICENSE" Copyrights 2006\-2019 by [Mark Overmeer ]. For other contributors see ChangeLog. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See \fIhttp://dev.perl.org/licenses/\fR