Execute a XQuery with PHP

前端 未结 8 769
青春惊慌失措
青春惊慌失措 2020-11-30 13:02

How to execute a XQuery in PHP? Can you give me an example?

Thank you.

相关标签:
8条回答
  • 2020-11-30 13:26

    There is this page at http://phpxmlclasses.sourceforge.net/ that has an XQuery Lite class:

    • http://phpxmlclasses.sourceforge.net/show_doc.php?class=class_xquery_lite.html

    A PHP implementation of the Xquery Lite 1.0 language, a language to query XML documents based on Xquery 1.0 This class is based on the DOM extension and allows to execute Xquery Lite queries for XML documents in files, php strings or combinations.

    I have never used it and do not know how it performs.

    0 讨论(0)
  • 2020-11-30 13:29

    The following link should be useful: http://dl.dropbox.com/u/1487285/php/php.html

    <?php
    require_once 'Zorba/XQueryProcessor.php'; 
    
    $xquery = new XQueryProcessor(); 
    
    $query = <<<'XQ'
      declare variable $world external; 
      <h1>Hello {$world}</h1>
    XQ; 
    
    $xquery->importQuery($query); 
    
    $xquery->setVariable('world', 'World!'); 
    
    echo $xquery->execute(); 
    ?>
    
    0 讨论(0)
提交回复
热议问题