XQUERY command and PHP

Monday, 2 December 2013 · 2 messages
YM
Yoann Maingonin reply to Tsvetanka Georgieva-Trifonova, 2 Dec 2013, 13:522 Dec 2013 12:57 #
Hi, I intensively use both. So yes it is possible here is an example:
        case "get_projects":
            $xquery = "XQUERY "
                    . "for \$meetingsActors in
//meeting/actors/userlink[@uid='$userId'], "
                    . " \$projects in //project "
                    . " where \$meetingsActors/../../@prID = \$projects/@id
"
                    . " return \$projects ";
            $projectActorsMeetingActor = $session->execute($xquery);

            $contentFull =
"<MN>)<actor>$projectActorsMeetingActor</actor></MN>";
            echo $contentFull;
            break;
*Cordialement / Best Regards,* *Yoann Maingon* Minerva France *+33 6 64 32 49 66* Download Aras Innovator - Téléchargez Aras Innovator<http://www.aras.com/support/downloads/downloadInnovator.aspx> 2013/12/2 Tsvetanka Georgieva-Trifonova <cvetygeorg at yahoo.com>
Quoted text · Tsvetanka Georgieva-Trifonova · 45 lines
> Hi Basex, > My question is about the command XQUERY [query]. > Does it work with any XQuery queries or only with XPath? > I tried the following: > <?php > include("BaseXClient.php"); > // create session > $session = new Session("localhost", 1984, "admin", "admin"); > $session->execute("open myfirstdatabase"); > > echo $session->execute("xquery for $n in //country[name = 'Switzerland'] > return $n") ; > > // close session > $session->close(); > ?> > This example causes the error: [XPST0003] Incomplete 'window' expression.' > But the following example: > <?php > include("BaseXClient.php"); > // create session > $session = new Session("localhost", 1984, "admin", "admin"); > $session->execute("open myfirstdatabase"); > > echo $session->execute("xquery //country[name = 'Switzerland']") ; > > // close session > $session->close(); > ?> > is executed without error. > The difference between the two examples is that one uses XQuery and > another - XPath expression. > Please, tell me whether the command XQUERY can be used with any XQuery > queries and how exactly? > Thanks & regards, > Tsvetanka > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >
TG
Tsvetanka Georgieva-Trifonova2 Dec 2013 13:52 #
Hi Basex, My question is about the command XQUERY [query]. Does it work with any XQuery queries or only with XPath? I tried the following: <?php include("BaseXClient.php"); // create session $session = new Session("localhost", 1984, "admin", "admin"); $session->execute("open myfirstdatabase"); echo $session->execute("xquery for $n in //country[name = 'Switzerland'] return $n") ;
  // close session
  $session->close();
?>
This example causes the error: [XPST0003] Incomplete 'window' expression.'
But the following example:
<?php
  include("BaseXClient.php");
  // create session
  $session = new Session("localhost", 1984, "admin", "admin");
  $session->execute("open myfirstdatabase");
echo $session->execute("xquery //country[name = 'Switzerland']") ; // close session $session->close(); ?> is executed without error. The difference between the two examples is that one uses XQuery and another - XPath expression. Please, tell me whether the command XQUERY can be used with any XQuery queries and how exactly? Thanks & regards, Tsvetanka

⚡Generated with XQuery