XQuery_lite for PHP - 有人设法让它工作吗?
我正在尝试将 XQuery 与 PHP 结合使用。我知道的唯一实现是 XQuery_Lite,它是 XMLClasses 库的一部分,但如果我能让它做任何事情,我就该死了。
自带的demo.php页面出现错误。每当我尝试执行那里的示例之一时,我都会得到:
Warning: bib is not visible from here plase use a global string for XML data in
C:\xampp\htdocs\test\xquery\xquery_lite_2\class_xquery_lite.php on line 201
Warning: Invalid argument supplied for foreach() in
C:\xampp\htdocs\test\xquery\xquery_lite_2\class_xquery_lite.php on line 690
然后我创建了这个超级简单的脚本(注意:代码来自自述 PDF,并且 bib.xml 确实存在):
<?php
$query = '<bib>
{
for $b in document("bib.xml")/bib/book
where $b/publisher = "Addison-Wesley" and $b/@year > 1991
return
<book year="{ $b/@year }">
{ $b/title }
</book>
}
</bib>';
$query = stripslashes($query);
include_once("class_xquery_lite.php");
$xq = new XqueryLite();
$result=$xq->evaluate_xqueryl($query);
?>
...但是我' m 告诉第 179 行的 foreach 正在输入一个空数组。经过一番挖掘,这似乎意味着 $functions 数组为空(在主 class_xquery_lite.php 脚本中)。
这一切都非常具体,所以我预计没有人可以在这里提供帮助,但你永远不知道......
I'm attempting to use XQuery with PHP. The only implementation I'm aware of is XQuery_Lite, part of the XMLClasses library, but I'm damned if I can get it to do anything.
The demo.php page that comes with it errors. Whenever I try to execute one of the examples on there, I get:
Warning: bib is not visible from here plase use a global string for XML data in
C:\xampp\htdocs\test\xquery\xquery_lite_2\class_xquery_lite.php on line 201
Warning: Invalid argument supplied for foreach() in
C:\xampp\htdocs\test\xquery\xquery_lite_2\class_xquery_lite.php on line 690
I then created this uber-simple script (note: the code came from the read-me PDF, and bib.xml does exist):
<?php
$query = '<bib>
{
for $b in document("bib.xml")/bib/book
where $b/publisher = "Addison-Wesley" and $b/@year > 1991
return
<book year="{ $b/@year }">
{ $b/title }
</book>
}
</bib>';
$query = stripslashes($query);
include_once("class_xquery_lite.php");
$xq = new XqueryLite();
$result=$xq->evaluate_xqueryl($query);
?>
...but I'm told that the foreach on line 179 is being fed an empty array. After some digging, this appears to mean the $functions array is empty (in the main class_xquery_lite.php script).
This is all very specific so I don't anticipate anyone can help here, but you never know...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论