HI Guys THanks a lot for your help. It works in the online demo of Basex. However, do you know why nothing is printed out after executing the php code? Can someone point out any documents that I could read so that I wont bother you guys so much. THanks again.
Serena <? echo "Documents whose types are :".$trantype.":<br>"; $cmd='let $doc:=doc("multi_table") let $udpid := $doc//types/type[name = "'.$trantype.'"]/@id/data() for $transation in $doc//transation where $transation/istype/@type=$udpid return <transation>{ $transation/@id }</transation>';
try { // create session $session = new Session("localhost", 1984, "admin", "admin"); $query = $session->query($cmd); print $query->init(); while($query->more()) { print $query->next()."\n"; }
// close session print $query->close(); print $session->close(); } catch (Exception $e) { // print exception print $e->getMessage(); } ?>
The xml file is <?xml version="1.0" encoding="UTF-8"?> <root> <Journal> <Document id="1"> <Author name="do-not-reply%40domaintools.com" reputation="1.0"/> <Time>Sat, 1 May 2010 00:55:20 -0700 (PDT)</Time> <Entity> <URL>http%3A%2F%2Fwww.domaintools.com%2Fmark-alert%2F</URL> <Domain>mexicoisart.com</Domain> <IP>199.236.158.250</IP> </Entity> </Journal> <transactions> <ip id="1"> <value>66.28.0.45</value> <transation id="56977"> <time>09 Sep 10 23:00:52</time> <istype type="type1"/> <src>10.8.124.143</src> <dst>66.28.0.45</dst> <status>INT</status> </transation> </ip> <ip id="2"> <value>66.28.0.61</value> <transation id="63050"> <time>09 Sep 10 23:01:00</time> <istype type="type1"/> <src>10.8.124.143</src> <dst>66.28.0.61</dst> <status>INT</status> </transation> </ip> </transactions> <types> <type id="type1"> <name>udp</name> </type> </types> </root>