<?xml version="1.0" encoding="windows-1252"?>
<node id="998230" title="Re: XPath-like method for searching/editing structures" created="2012-10-10 09:32:18" updated="2012-10-10 09:32:18">
<type id="11">
note</type>
<author id="647953">
sundialsvc4</author>
<data>
<field name="doctext">
&lt;p&gt;
As an aside, it can be useful to rig-up a &amp;ldquo;data walker&amp;rdquo; object that will iterate through a data-structure ... search [http://search.cpan.org] for &amp;ldquo;walker&amp;rdquo; ... and then perhaps maintain a push-down stack of such objects. &amp;nbsp; Once, I solved a similar problem by devising a walker that would call a specified sub (coderef ...) when it found a matching node. &amp;nbsp; Each subroutine in turn made the decisions that needed to be made at that level, and spawned another walker-instance to proceed further. &amp;nbsp; Thus, the walkers handled the task of navigation while the subroutines made the case-specific decisions. &amp;nbsp; (It was a lot easier to do than to describe.) &amp;nbsp; I did it this way because, while I could not predict what the shape and depth of the structure would be, I could describe the logic as a small number of reusable, node-specific cases.
&lt;/p&gt;</field>
<field name="root_node">
998063</field>
<field name="parent_node">
998063</field>
</data>
</node>
