本文整理汇总了PHP中XmlManager::createQueryContext方法的典型用法代码示例。如果您正苦于以下问题:PHP XmlManager::createQueryContext方法的具体用法?PHP XmlManager::createQueryContext怎么用?PHP XmlManager::createQueryContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlManager
的用法示例。
在下文中一共展示了XmlManager::createQueryContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: XmlManager
book1 = <book><title>Knowledge Discovery in Databases.</title></book>
ACTUAL RESULT:
<?php
#
# This is a very simple example of using try/catch and XmlException
# to get information on an exception thrown from Berkeley DB XML.
# The line that generates the exception is the query, which uses
# bad XQuery syntax.
#
$book_name = 'book1';
$book_content = '<book><title>Knowledge Discovery in Databases.</title></book>';
$mgr = new XmlManager();
try {
$con = $mgr->createContainer("test.dbxml");
$con->putDocument($book_name, $book_content);
$qc = $mgr->createQueryContext();
$res = $mgr->query("collection('test.dbxml')/x[", $qc);
$doc = $con->getDocument("foo");
$s = $doc->getContentAsString();
print $doc->getName() . " = {$s}\n";
unset($doc);
unset($con);
} catch (XmlException $xe) {
print "XmlException message: " . $xe->what() . "\n";
print "XmlException code: " . $xe->getExceptionCode() . "\n";
print "XmlException dbErrno: " . $xe->getDbErrno() . "\n";
print "Query line: " . $xe->getQueryLine() . "\n";
print "Query column: " . $xe->getQueryColumn() . "\n";
unset($con);
}
$mgr->removeContainer("test.dbxml");