cvs: pear /XML_XPath XPath.php package.xml /XML_XPath/XPath result.php /XML_XPath/docs XML_XPath_example.php
| From: | bertrand GUGGER | Date: | Wed, 12 Oct 2005 14:48:56 +0000 |
| Subject: | cvs: pear /XML_XPath XPath.php package.xml /XML_XPath/XPath result.php /XML_XPath/docs XML_XPath_example.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-35446@lists.php.net to get a copy of this message | ||
toggg Wed Oct 12 10:48:56 2005 EDT
Modified files:
/pear/XML_XPath XPath.php package.xml
/pear/XML_XPath/XPath result.php
/pear/XML_XPath/docs XML_XPath_example.php
Log:
fixed the $this assignments
adapted the error handling
refactored example, added function microtime_float to replace inexistant systime()
http://cvs.php.net/diff.php/pear/XML_XPath/XPath.php?r1=1.18&r2=1.19&ty=u
Index: pear/XML_XPath/XPath.php
diff -u pear/XML_XPath/XPath.php:1.18 pear/XML_XPath/XPath.php:1.19
--- pear/XML_XPath/XPath.php:1.18 Mon Aug 18 00:04:45 2003
+++ pear/XML_XPath/XPath.php Wed Oct 12 10:48:52 2005
@@ -17,7 +17,7 @@
// | Authors: Dan Allen <dan@mojavelinux.com> |
// +----------------------------------------------------------------------+
-// $Id: XPath.php,v 1.18 2003/08/18 04:04:45 dallen Exp $
+// $Id: XPath.php,v 1.19 2005/10/12 14:48:52 toggg Exp $
// }}}
// {{{ description
@@ -89,6 +89,9 @@
/** @var boolean determines if we have loaded a document or not */
var $loaded = false;
+ /** @var boolean error indicator */
+ var $error = false;
+
// }}}
// {{{ constructor
@@ -98,7 +101,7 @@
// if not defined, require load() to be called
if (!is_null($in_xml)) {
if (XML_XPath::isError($result = $this->load($in_xml, $in_type))) {
- $this = $result;
+ $this->error = $result;
}
}
}
@@ -194,7 +197,13 @@
*/
function isError($in_value)
{
- return is_a($in_value, 'xml_xpath_error');
+ if (is_a($in_value, 'xml_xpath_error')) {
+ return true;
+ }
+ if (is_a($in_value, 'xml_xpath')) {
+ return (bool) $in_value->error;
+ }
+ return false;
}
// }}}
@@ -237,7 +246,11 @@
// If this is an error object, then grab the corresponding error code
if (XML_XPath::isError($in_value)) {
- $in_value = $in_value->getCode();
+ if (is_a($in_value, 'xml_xpath_error')) {
+ $in_value = $in_value->getCode();
+ } else {
+ $in_value = $in_value->error->getCode();
+ }
}
// return the textual error message corresponding to the code
@@ -273,7 +286,7 @@
*/
function free()
{
- $this = null;
+ $this->reset();
}
// }}}
http://cvs.php.net/diff.php/pear/XML_XPath/package.xml?r1=1.10&r2=1.11&ty=u
Index: pear/XML_XPath/package.xml
diff -u pear/XML_XPath/package.xml:1.10 pear/XML_XPath/package.xml:1.11
--- pear/XML_XPath/package.xml:1.10 Thu Jan 29 20:36:25 2004
+++ pear/XML_XPath/package.xml Wed Oct 12 10:48:52 2005
@@ -28,16 +28,17 @@
</maintainers>
<release>
<license>PHP License</license>
- <date>2004-01-29</date>
- <state>devel</state>
- <version>1.2.1</version>
+ <date>2005-10-12</date>
+ <state>stable</state>
+ <version>1.2.2</version>
<deps>
<dep type="php" rel="ge" version="4.2.1" />
<dep type="ext" rel="has">domxml</dep>
</deps>
<notes>
- * fixed a long standing bug where the get_class() failed due to a case problem, causing all
load() operations to fail in newer releases of PHP
- * changed state to devel
+ * fixed the $this assignments (toggg)
+ * adapted the error handling (toggg)
+ * refactored example, added function microtime_float to replace inexistant systime() (toggg)
</notes>
<filelist>
<dir name="/" baseinstalldir="XML">
@@ -55,6 +56,15 @@
</release>
<changelog>
<release>
+ <date>2005-10-12</date>
+ <state>devel</state>
+ <version>1.2.1</version>
+ <notes>
+ * fixed a long standing bug where the get_class() failed due to a case problem, causing all
load() operations to fail in newer releases of PHP
+ * changed state to devel
+ </notes>
+ </release>
+ <release>
<version>1.2</version>
<date>2002-06-07</date>
<state>beta</state>
http://cvs.php.net/diff.php/pear/XML_XPath/XPath/result.php?r1=1.14&r2=1.15&ty=u
Index: pear/XML_XPath/XPath/result.php
diff -u pear/XML_XPath/XPath/result.php:1.14 pear/XML_XPath/XPath/result.php:1.15
--- pear/XML_XPath/XPath/result.php:1.14 Thu Jan 16 14:10:52 2003
+++ pear/XML_XPath/XPath/result.php Wed Oct 12 10:48:55 2005
@@ -17,7 +17,7 @@
// | Authors: Dan Allen <dan@mojavelinux.com> |
// +----------------------------------------------------------------------+
-// $Id: result.php,v 1.14 2003/01/16 19:10:52 dallen Exp $
+// $Id: result.php,v 1.15 2005/10/12 14:48:55 toggg Exp $
// }}}
// {{{ description
@@ -505,7 +505,9 @@
*/
function free()
{
- $this = null;
+ $this->data = null;
+ $this->ctx = null;
+ $this->xml = null;
}
// }}}
http://cvs.php.net/diff.php/pear/XML_XPath/docs/XML_XPath_example.php?r1=1.2&r2=1.3&ty=u
Index: pear/XML_XPath/docs/XML_XPath_example.php
diff -u pear/XML_XPath/docs/XML_XPath_example.php:1.2 pear/XML_XPath/docs/XML_XPath_example.php:1.3
--- pear/XML_XPath/docs/XML_XPath_example.php:1.2 Wed Jun 12 17:23:55 2002
+++ pear/XML_XPath/docs/XML_XPath_example.php Wed Oct 12 10:48:56 2005
@@ -1,7 +1,17 @@
<?php
+// $Id: XML_XPath_example.php,v 1.3 2005/10/12 14:48:56 toggg Exp $
error_reporting(E_ALL);
-require_once '../XPath.php';
+function microtime_float()
+{
+ list($usec, $sec) = explode(" ", microtime());
+ return ((float)$usec + (float)$sec);
+}
+
+require_once 'XML/XPath.php';
$xml = new XML_XPath();
+if (XML_XPath::isError($xml)) {
+ die(XML_XPath::errorMessage($xml));
+}
$string = '<?xml version="1.0"?>
<doc foo="bar">
<child1>foo</child1>
@@ -31,12 +41,12 @@
$result = $xml->evaluate(array('.', 'i/dont/exist'));
print_r($result);
print_r($result->substringData());
-$now = systime();
+$now = microtime_float();
foreach (range(0, 50) as $i) {
$xml->nodeName();
}
echo 'Timing:' . "\n";
-echo systime() - $now;
+echo microtime_float() - $now;
echo "\n";
if ($reports->evaluate(array('.', '..'), true)) {
echo $reports->nodeName();