logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

XML::Compile::Iterator - reduce view on a node tree

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.

License

       Copyrights 2006-2024 by [Mark Overmeer <markov@cpan.org>]. For other contributors see ChangeLog.

       This program is free software; you can redistribute it and/or modify it under  the  same  terms  as  Perl
       itself.  See http://dev.perl.org/licenses/

perl v5.40.0                                       2024-10-27                        XML::Compile::Iterator(3pm)

Methods

Constructors
       $obj->descend( [$node, [$path, [$filter]]] )
           The  $node  is a child of the node handled by the iterator where this method is called upon.  Without
           explicit $node, the current node is used.  Returned is a new XML::Compile::Iterator object.  The  new
           iterator will use the same $filter as the parent iterator by default.  The internal administered path
           with be extended with the $path.

       XML::Compile::Iterator->new($node, $path, $filter,)
           The $node is a XML::LibXML::Node object, of which the direct children are inspected.

           The  $filter  a CODE reference which is called for each child node.  The only parameter is the parent
           $node, and then it must return either true or false.  In case of true, the  node  is  selected.   The
           FILTERS  is  applied  to  all  children  of  the $node once, when the first child is requested by the
           program.

   Attributes
       $obj->filter()
           Returns the CODE reference which is used to select the nodes.

       $obj->node()
           Returns the XML::LibXML::Node node of which the children are walked through.

       $obj->path()
           The path represents the location where the node is, like a symbolic link, how you got there.

   Scanning
       $obj->childs()
           Returns the child nodes which fulfil the filter requirements.  In LIST context  as  list,  in  SCALAR
           context as reference to an ARRAY.

       $obj->currentChild()
           Returns the current child node.

       $obj->firstChild()
           Returns the first child node.  Does not change the current position.

       $obj->lastChild()
           Returns the last child node which fulfills the requirements.  Does not change the current position.

       $obj->nextChild()
           Returns the next child when available, otherwise "undef".

       $obj->nrChildren()
           Returns the number of childnodes which fulfill the restriction.

       $obj->previousChild()
           Returns the previous child when available, otherwise "undef".

   simplifyXMLnodeaccess
       $obj->currentContent()
           Returns the textContent of the currentChild() node, or undef.

       $obj->currentLocal()
           Returns the local name of the currentChild(), or the empty string.

       $obj->currentType()
           Returns the type of the currentChild(), or the empty string.

       $obj->nodeLocal()
           Returns the local name of the node(), or the empty string.

       $obj->nodeNil()
           Returns true if the current node has "xsi:type="true"".

       $obj->nodeType()
           Returns the type of the node(), or the empty string.

       $obj->textContent()
           Returns the textContent of the node(), or undef.

Name

       XML::Compile::Iterator - reduce view on a node tree

See Also

       This  module  is  part  of  XML-Compile  distribution  version  1.64, built on October 21, 2024. Website:
       http://perl.overmeer.net/xml-compile/

Synopsis

See Also