*/
function_entry qtdom_functions[] = {
PHP_FE(qdom_tree, NULL)
+ PHP_FE(qdom_error, NULL)
{NULL, NULL, NULL} /* Must be the last line in qtdom_functions[] */
};
qdomdoc_class_entry_ptr = zend_register_internal_class(&qdomdoc_class_entry);
qdomnode_class_entry_ptr = zend_register_internal_class(&qdomnode_class_entry);
+ qdom_init();
+
return SUCCESS;
}
/* Remove comments if you have entries in php.ini
UNREGISTER_INI_ENTRIES();
*/
+ qdom_shutdown();
+
return SUCCESS;
}
return count;
}
-/* {{{ proto string qdom_tree( string )
+/* {{{ proto object qdom_tree( string )
creates a tree of an xml string */
PHP_FUNCTION(qdom_tree)
{
struct qdom_node *node;
zval *children;
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg) == FAILURE) {
+ if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg) == FAILURE)
+ {
WRONG_PARAM_COUNT;
}
convert_to_string(arg);
+ qdom_do_install_message_handler();
+
qdom_do_version( &qt_ver );
object_init_ex(return_value, qdomdoc_class_entry_ptr);
}
qdom_do_free( doc );
+ qdom_do_free_message_handler();
+}
+/* }}} */
+
+/* {{{ proto string qdom_error()
+ Returns the error string from the last QDOM operation or FALSE if no errors occured.*/
+PHP_FUNCTION(qdom_error)
+{
+ char *error = qdom_error_log();
+ if ( error == 0 )
+ RETURN_FALSE;
+ RETURN_STRING( error, 1 );
}
/* }}} */