<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello all,<div><br></div><div>I decided to use eXist as a database for an application that I am writing in Perl and </div><div>I am experimenting with it. The problem is that I have stored a .xml document with the following structure</div><div><br></div><div><div><font class="Apple-style-span" color="#2B00FF"><foo-bar00></font></div><div><font class="Apple-style-span" color="#2B00FF"> <perfdata datum="GigabitEthernet3_0_18"></font></div><div><font class="Apple-style-span" color="#2B00FF"> <cli cmd="whatsup" detail="GigabitEthernet3/0/18" find="" given=""></font></div><div><font class="Apple-style-span" color="#2B00FF"> <input_rate>3</input_rate></font></div><div><font class="Apple-style-span" color="#2B00FF"> <output_rate>3</output_rate></font></div><div><font class="Apple-style-span" color="#2B00FF"> </cli></font></div><div><font class="Apple-style-span" color="#2B00FF"> </perfdata></font></div><div><font class="Apple-style-span" color="#2B00FF"> <timeline>2011-5-23T11:15:33</timeline></font></div><div><font class="Apple-style-span" color="#2B00FF"></foo-bar00></font></div></div><div><br></div><div>and it is located in the "<span class="Apple-style-span" style="font-family: Menlo; font-size: 11px; "><font class="Apple-style-span" color="#2B00FF">/db/LAB/foo-bar00/2011/5/23/11_15_33.xml</font></span>" collection.</div><div><br></div><div>I can successfully query it, like</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" color="#2B00FF">my $xquery = 'doc("/db/LAB/foo-bar00/2011/5/23/11_15_33.xml")' ;</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">or $xquery can be equal to</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><b>=</b> doc("/db/LAB/foo-bar00/2011/5/23/11_15_33.xml")/foo-bar00/perfdata/cli/data(output_rate)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><b>=</b> doc("/db/LAB/foo-bar00/2011/5/23/11_15_33.xml")/foo-bar00/data(timeline)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" color="#2B00FF"><br></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" color="#2B00FF">my ($rc1, $set) = $eXist->executeQuery($xquery) ;</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" color="#2B00FF">my ($rc2, $count) = $eXist->numberOfResults($set) ;</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" color="#2B00FF">my ($rc3, @data) = $eXist->retrieveResults($set) ;</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" color="#2B00FF">$eXist->releaseResultSet($set) ;</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" color="#2B00FF">print Dumper(@data) ;</font></div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" color="#2B00FF"><br></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" color="#2B00FF"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">And the result is :</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" color="#2B00FF"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF">$VAR1 = {</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> 'hitCount' => 1,</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> 'foo-bar00' => {</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> 'perfdata' => {</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> 'cli' => {</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> 'given' => '',</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> 'detail' => 'GigabitEthernet3/0/18',</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> 'input_rate' => '3',</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> 'cmd' => 'whatsup',</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> 'output_rate' => '3',</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> 'find' => ''</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> },</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> 'datum' => 'GigabitEthernet3_0_18'</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> },</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> 'timeline' => '2011-5-23T11:15:33'</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> }</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF">};</font></span></font></div></span></font></div><div><br></div><div>---> Given that I know the xml document that I want to retrieve info from.</div><div>---> Given that I want to retrieve the timeline information.</div><div><br></div><div>When I am writing :</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" color="#2B00FF">my $db_xml_doc = "/db/LAB/foo-bar00/2011/5/23/11_15_33.xml" ;</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" color="#2B00FF">my ($db_rc, $db_datum) = $eXist->queryXPath("/foo-bar00/timeline", $db_xml_doc, "") ;</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" color="#2B00FF">print Dumper($db_datum) ;</font></div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" color="#2B00FF"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">The result is :</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" color="#2B00FF"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF">$VAR1 = {</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> 'hash' => 1717362942,</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> 'id' => 3,</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> 'results' => [</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> {</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> 'node_id' => '1.2',</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> 'document' => '/db/LAB/foo-bar00/2011/5/23/11_15_33.xml'</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> }</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF"> ]</font></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#2B00FF">};</font></span></font></div><div><br></div><div>********** The question is : How can I retrieve the "timeline" info ? </div><div>Seems that the "node_id" variable (=1.2) can points to the "timeline" info, but how can I use it ?</div><div><br></div><div>Thank you.</div></span></font></div></body></html>