summaryrefslogtreecommitdiff
path: root/ext/dom
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2003-09-03 10:11:53 +0000
committerRob Richards <rrichards@php.net>2003-09-03 10:11:53 +0000
commit5630dd0be2293fb707c40339b334dbb8b950bf52 (patch)
treed35d4f030ff234e0f8e3d74ec8b6fbbfbdb5dfc1 /ext/dom
parent93f0ee5fda6fa6d296b76d25bf85254d18fb2888 (diff)
downloadphp-git-5630dd0be2293fb707c40339b334dbb8b950bf52.tar.gz
add document HTML load/save methods
add document standalone validate method cleanup some prototype declarations domexception inherits from default exception
Diffstat (limited to 'ext/dom')
-rw-r--r--ext/dom/document.c199
-rw-r--r--ext/dom/dom_fe.h8
-rw-r--r--ext/dom/domexception.c15
-rw-r--r--ext/dom/php_dom.c97
4 files changed, 221 insertions, 98 deletions
diff --git a/ext/dom/document.c b/ext/dom/document.c
index f6b9772524..933b314949 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -75,10 +75,16 @@ zend_function_entry php_dom_document_class_functions[] = {
PHP_FALIAS(loadXML, dom_document_loadxml, NULL)
PHP_FALIAS(saveXML, dom_document_savexml, NULL)
PHP_FALIAS(domdocument, dom_document_document, NULL)
+ PHP_FALIAS(validate, dom_document_validate, NULL)
+#if defined(LIBXML_HTML_ENABLED)
+ PHP_FALIAS(loadHTML, dom_document_load_html, NULL)
+ PHP_FALIAS(loadHTMLFile, dom_document_load_html_file, NULL)
+ PHP_FALIAS(saveHTML, dom_document_save_html, NULL)
+ PHP_FALIAS(saveHTMLFile, dom_document_save_html_file, NULL)
+#endif /* defined(LIBXML_HTML_ENABLED) */
{NULL, NULL, NULL}
};
-/* {{{ void add_domdocument_properties(zval *id) */
void add_domdocument_properties(zval *id TSRMLS_DC) {
add_property_bool(id, "formatOutput", 0);
add_property_bool(id, "validateOnParse", 0);
@@ -86,9 +92,7 @@ void add_domdocument_properties(zval *id TSRMLS_DC) {
add_property_bool(id, "preserveWhiteSpace", 1);
add_property_bool(id, "substituteEntities", 0);
}
-/* }}} end add_domdocument_properties */
-/* {{{ static int dom_document_get_property_int(zval *id, char *property TSRMLS_DC) */
static int dom_document_get_property_int(zval *id, char *property TSRMLS_DC) {
zval *format, *member;
zend_object_handlers *std_hnd;
@@ -109,10 +113,28 @@ static int dom_document_get_property_int(zval *id, char *property TSRMLS_DC) {
return retformat;
}
-/* }}} end dom_document_get_property_int */
-/* {{{ static void php_dom_ctx_error(void *ctx, const char *msg, ...) */
-static void php_dom_ctx_error(void *ctx, const char *msg, ...) {
+static void php_dom_validate_error(void *ctx, const char *msg, ...)
+{
+ char *buf;
+ va_list ap;
+ int len;
+
+ va_start(ap, msg);
+ len = vspprintf(&buf, 0, msg, ap);
+ va_end(ap);
+
+ /* remove any trailing \n */
+ while (len && buf[--len] == '\n') {
+ buf[len] = '\0';
+ }
+
+ php_error(E_WARNING, "%s", buf);
+ efree(buf);
+}
+
+static void php_dom_ctx_error(void *ctx, const char *msg, ...)
+{
va_list ap;
char *buf;
int len;
@@ -132,7 +154,6 @@ static void php_dom_ctx_error(void *ctx, const char *msg, ...) {
php_error(E_WARNING, "%s in %s, line: %d", buf, parser->input->filename, parser->input->line);
efree(buf);
}
-/* }}} end php_dom_ctx_error */
/* {{{ proto doctype documenttype
readonly=yes
@@ -210,7 +231,6 @@ int dom_document_document_element_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
/* {{{ proto actual_encoding string
readonly=no
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-actualEncoding
@@ -1057,7 +1077,6 @@ PHP_FUNCTION(dom_document_document)
}
/* }}} end dom_document_document */
-/* {{{ static xmlDocPtr dom_document_parser(zval *id, int mode, char *source TSRMLS_DC) */
static xmlDocPtr dom_document_parser(zval *id, int mode, char *source TSRMLS_DC) {
xmlDocPtr ret;
xmlParserCtxtPtr ctxt;
@@ -1121,9 +1140,7 @@ static xmlDocPtr dom_document_parser(zval *id, int mode, char *source TSRMLS_DC)
return(ret);
}
-/* }}} end dom_parser_document */
-/* {{{ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) */
static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) {
zval *id, *rv = NULL;
xmlDoc *docp = NULL, *newdoc;
@@ -1170,7 +1187,6 @@ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) {
DOM_RET_OBJ(rv, (xmlNodePtr) newdoc, &ret, NULL);
}
}
-/* }}} end dom_parser_document */
/* {{{ proto boolean domnode dom_document_load(string source);
URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-load
@@ -1278,4 +1294,161 @@ PHP_FUNCTION(dom_document_savexml)
}
}
/* }}} end dom_document_savexml */
-#endif
+
+/* {{{ proto string domnode dom_document_validate();
+Since: DOM extended
+*/
+PHP_FUNCTION(dom_document_validate)
+{
+ zval *id;
+ xmlDoc *docp;
+ dom_object *intern;
+ xmlValidCtxt cvp;
+
+ DOM_GET_THIS_OBJ(docp, id, xmlDocPtr, intern);
+
+ if (docp->intSubset == NULL) {
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "No DTD given in XML-Document");
+ }
+
+ cvp.userData = NULL;
+ cvp.error = (xmlValidityErrorFunc) php_dom_validate_error;
+ cvp.warning = NULL;
+
+ if (xmlValidateDocument(&cvp, docp)) {
+ RETVAL_TRUE;
+ } else {
+ RETVAL_FALSE;
+ }
+}
+/* }}} end dom_document_validate */
+
+
+#if defined(LIBXML_HTML_ENABLED)
+
+static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode)
+{
+ zval *id, *rv = NULL;
+ xmlDoc *docp = NULL, *newdoc;
+ dom_object *intern;
+ char *source;
+ int source_len, refcount, ret;
+
+ id = getThis();
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &source, &source_len) == FAILURE) {
+ return;
+ }
+
+ if (mode == DOM_LOAD_FILE) {
+ if ((PG(safe_mode) && (!php_checkuid(source, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(source TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
+ newdoc = htmlParseFile(source, NULL);
+ } else {
+ newdoc = htmlParseDoc(source, NULL);
+ }
+
+ if (!newdoc)
+ RETURN_FALSE;
+
+ if (id != NULL) {
+ intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC);
+ if (intern != NULL) {
+ docp = (xmlDocPtr) dom_object_get_node(intern);
+ if (docp != NULL) {
+ decrement_node_ptr(intern TSRMLS_CC);
+ refcount = decrement_document_reference(intern TSRMLS_CC);
+ if (refcount != 0) {
+ docp->_private = NULL;
+ }
+ }
+ intern->document = NULL;
+ increment_document_reference(intern, newdoc TSRMLS_CC);
+ }
+
+ php_dom_set_object(intern, (xmlNodePtr) newdoc TSRMLS_CC);
+
+ RETURN_TRUE;
+ } else {
+ DOM_RET_OBJ(rv, (xmlNodePtr) newdoc, &ret, NULL);
+ }
+}
+
+/* {{{ proto boolean domnode dom_document_load_html_file(string source);
+Since: DOM extended
+*/
+PHP_FUNCTION(dom_document_load_html_file)
+{
+ dom_load_html(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE);
+}
+/* }}} end dom_document_load_html_file */
+
+/* {{{ proto boolean domnode dom_document_load_html(string source);
+Since: DOM extended
+*/
+PHP_FUNCTION(dom_document_load_html)
+{
+ dom_load_html(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING);
+}
+/* }}} end dom_document_load_html */
+
+/* {{{ proto long dom_document_save_html_file(string file);
+Convenience method to save to file as html
+*/
+PHP_FUNCTION(dom_document_save_html_file)
+{
+ zval *id;
+ xmlDoc *docp;
+ int file_len, bytes, format;
+ dom_object *intern;
+ char *file;
+
+ DOM_GET_THIS_OBJ(docp, id, xmlDocPtr, intern);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_len) == FAILURE) {
+ return;
+ }
+
+ if ((PG(safe_mode) && (!php_checkuid(file, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(file TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
+
+ /* encoding handled by property on doc */
+ format = dom_document_get_property_int(id, "formatOutput" TSRMLS_CC);
+ bytes = htmlSaveFileFormat(file, docp, NULL, format);
+
+ if (bytes == -1) {
+ RETURN_FALSE;
+ }
+ RETURN_LONG(bytes);
+}
+/* }}} end dom_document_save_html_file */
+
+/* {{{ proto string dom_document_save_html();
+Convenience method to output as html
+*/
+PHP_FUNCTION(dom_document_save_html)
+{
+ zval *id;
+ xmlDoc *docp;
+ dom_object *intern;
+ xmlChar *mem;
+ int size;
+
+ DOM_GET_THIS_OBJ(docp, id, xmlDocPtr, intern);
+
+ htmlDocDumpMemory(docp, &mem, &size);
+ if (!size) {
+ if (mem)
+ xmlFree(mem);
+ RETURN_FALSE;
+ }
+ RETVAL_STRINGL(mem, size, 1);
+ xmlFree(mem);
+}
+/* }}} end dom_document_save_html */
+
+#endif /* defined(LIBXML_HTML_ENABLED) */
+
+#endif /* HAVE_LIBXML && HAVE_DOM */
diff --git a/ext/dom/dom_fe.h b/ext/dom/dom_fe.h
index b540d3bab7..287ee5651d 100644
--- a/ext/dom/dom_fe.h
+++ b/ext/dom/dom_fe.h
@@ -125,6 +125,14 @@ PHP_FUNCTION(dom_document_load);
PHP_FUNCTION(dom_document_save);
PHP_FUNCTION(dom_document_loadxml);
PHP_FUNCTION(dom_document_savexml);
+PHP_FUNCTION(dom_document_validate);
+
+#if defined(LIBXML_HTML_ENABLED)
+PHP_FUNCTION(dom_document_load_html);
+PHP_FUNCTION(dom_document_load_html_file);
+PHP_FUNCTION(dom_document_save_html);
+PHP_FUNCTION(dom_document_save_html_file);
+#endif /* defined(LIBXML_HTML_ENABLED) */
/* domnode methods */
PHP_FUNCTION(dom_node_insert_before);
diff --git a/ext/dom/domexception.c b/ext/dom/domexception.c
index ed9a46310b..a1be5cbb40 100644
--- a/ext/dom/domexception.c
+++ b/ext/dom/domexception.c
@@ -41,10 +41,8 @@ zend_function_entry php_dom_domexception_class_functions[] = {
{NULL, NULL, NULL}
};
-/* {{{ php_dom_throw_error */
void php_dom_throw_error(int error_code, int strict_error TSRMLS_DC)
{
- zval *dom_exception;
char *error_message;
switch (error_code)
@@ -102,17 +100,10 @@ void php_dom_throw_error(int error_code, int strict_error TSRMLS_DC)
}
if (strict_error == 1) {
- ALLOC_ZVAL(dom_exception);
- Z_TYPE_P(dom_exception) = IS_OBJECT;
- object_init_ex(dom_exception, dom_domexception_class_entry);
- dom_exception->refcount = 1;
- dom_exception->is_ref = 1;
- add_property_long(dom_exception, "code", error_code);
- add_property_stringl(dom_exception, "message", error_message, strlen(error_message), 1);
- EG(exception) = dom_exception;
+ zend_throw_exception(dom_domexception_class_entry, error_message, error_code TSRMLS_CC);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, error_message);
}
}
-/* }}} end php_dom_throw_error */
-#endif
+
+#endif /* HAVE_LIBXML && HAVE_DOM */
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index bf67c5223d..9faa45852f 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -73,7 +73,6 @@ static zend_function_entry dom_functions[] = {
{NULL, NULL, NULL}
};
-/* {{{ int dom_node_is_read_only(xmlNodePtr node) */
int dom_node_is_read_only(xmlNodePtr node) {
switch (node->type) {
case XML_ENTITY_REF_NODE:
@@ -95,9 +94,7 @@ int dom_node_is_read_only(xmlNodePtr node) {
}
}
}
-/* }}} end dom_node_is_read_only */
-/* {{{ int dom_node_children_valid(xmlNodePtr node) */
int dom_node_children_valid(xmlNodePtr node) {
switch (node->type) {
case XML_DOCUMENT_TYPE_NODE:
@@ -112,7 +109,6 @@ int dom_node_children_valid(xmlNodePtr node) {
return SUCCESS;
}
}
-/* }}} end dom_node_children_valid */
int dom_get_strict_error(dom_ref_obj *document) {
if (document) {
@@ -122,7 +118,6 @@ int dom_get_strict_error(dom_ref_obj *document) {
}
}
-/* {{{ int increment_document_reference(dom_object *object) */
int increment_document_reference(dom_object *object, xmlDocPtr docp TSRMLS_DC) {
int ret_refcount = -1;
@@ -139,9 +134,7 @@ int increment_document_reference(dom_object *object, xmlDocPtr docp TSRMLS_DC) {
return ret_refcount;
}
-/* }}} end increment_document_reference */
-/* {{{ int decrement_document_reference(dom_object *object) */
int decrement_document_reference(dom_object *object TSRMLS_DC) {
int ret_refcount = -1;
@@ -160,9 +153,7 @@ int decrement_document_reference(dom_object *object TSRMLS_DC) {
return ret_refcount;
}
-/* }}} end decrement_document_reference */
-/* {{{ int decrement_node_ptr(dom_object *object) */
int decrement_node_ptr(dom_object *object TSRMLS_DC) {
int ret_refcount = -1;
node_ptr *obj_node;
@@ -181,9 +172,7 @@ int decrement_node_ptr(dom_object *object TSRMLS_DC) {
return ret_refcount;
}
-/* }}} end decrement_node_ptr */
-/* {{{ xmlNodePtr dom_object_get_node(dom_object *obj) */
xmlNodePtr dom_object_get_node(dom_object *obj)
{
if (obj->ptr != NULL) {
@@ -192,9 +181,7 @@ xmlNodePtr dom_object_get_node(dom_object *obj)
return NULL;
}
}
-/* }}} end dom_object_get_node */
-/* {{{ dom_object_set_data */
static void dom_object_set_data(xmlNodePtr obj, dom_object *wrapper TSRMLS_DC)
{
if (wrapper == NULL) {
@@ -203,9 +190,7 @@ static void dom_object_set_data(xmlNodePtr obj, dom_object *wrapper TSRMLS_DC)
obj->_private = wrapper->ptr;
}
}
-/* }}} end dom_object_set_data */
-/* {{{ dom_object *dom_object_get_data(xmlNodePtr obj) */
dom_object *dom_object_get_data(xmlNodePtr obj)
{
if (obj->_private != NULL) {
@@ -214,9 +199,7 @@ dom_object *dom_object_get_data(xmlNodePtr obj)
return NULL;
}
}
-/* }}} end dom_object_get_data */
-/* {{{ php_dom_clear_object */
static void php_dom_clear_object(dom_object *object TSRMLS_DC)
{
if (object->prop_handler) {
@@ -225,9 +208,7 @@ static void php_dom_clear_object(dom_object *object TSRMLS_DC)
decrement_node_ptr(object TSRMLS_CC);
decrement_document_reference(object TSRMLS_CC);
}
-/* }}} end php_dom_clear_object */
-/* {{{ void php_dom_set_object(dom_object *object, xmlNodePtr obj TSRMLS_DC) */
void php_dom_set_object(dom_object *object, xmlNodePtr obj TSRMLS_DC)
{
node_ptr *obj_node;
@@ -248,9 +229,7 @@ void php_dom_set_object(dom_object *object, xmlNodePtr obj TSRMLS_DC)
}
}
}
-/* }}} end php_dom_set_object */
-/* {{{ dom_unregister_node */
void dom_unregister_node(xmlNodePtr nodep TSRMLS_DC)
{
dom_object *wrapper;
@@ -260,26 +239,20 @@ void dom_unregister_node(xmlNodePtr nodep TSRMLS_DC)
php_dom_clear_object(wrapper TSRMLS_CC);
}
}
-/* }}} end dom_unregister_node */
-/* {{{ dom_read_na */
static int dom_read_na(dom_object *obj, zval **retval TSRMLS_DC)
{
*retval = NULL;
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot read property");
return FAILURE;
}
-/* }}} */
-/* {{{ dom_write_na */
static int dom_write_na(dom_object *obj, zval *newval TSRMLS_DC)
{
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot write property");
return FAILURE;
}
-/* }}} */
-/* {{{ dom_register_prop_handler */
static void dom_register_prop_handler(HashTable *prop_handler, char *name, dom_read_t read_func, dom_write_t write_func TSRMLS_DC)
{
dom_prop_handler hnd;
@@ -288,9 +261,7 @@ static void dom_register_prop_handler(HashTable *prop_handler, char *name, dom_r
hnd.write_func = write_func ? write_func : dom_write_na;
zend_hash_add(prop_handler, name, strlen(name)+1, &hnd, sizeof(dom_prop_handler), NULL);
}
-/* }}} */
-/* {{{ dom_read_property */
zval *dom_read_property(zval *object, zval *member, zend_bool silent TSRMLS_DC)
{
dom_object *obj;
@@ -331,9 +302,7 @@ zval *dom_read_property(zval *object, zval *member, zend_bool silent TSRMLS_DC)
}
return retval;
}
-/* }}} */
-/* {{{ dom_write_property */
void dom_write_property(zval *object, zval *member, zval *value TSRMLS_DC)
{
dom_object *obj;
@@ -370,7 +339,6 @@ void dom_write_property(zval *object, zval *member, zval *value TSRMLS_DC)
zval_dtor(member);
}
}
-/* }}} */
zend_module_entry dom_module_entry = {
STANDARD_MODULE_HEADER,
@@ -400,7 +368,12 @@ PHP_MINIT_FUNCTION(dom)
zend_hash_init(&classes, 0, NULL, NULL, 1);
- REGISTER_DOM_CLASS(ce, "domexception", NULL, php_dom_domexception_class_functions, dom_domexception_class_entry);
+ INIT_CLASS_ENTRY(ce, "domexception", php_dom_domexception_class_functions);
+ dom_domexception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(), NULL TSRMLS_CC);
+ dom_domexception_class_entry->ce_flags |= ZEND_ACC_FINAL;
+ dom_domexception_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED;
+ zend_declare_property_long(dom_domexception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PUBLIC);
+
REGISTER_DOM_CLASS(ce, "domstringlist", NULL, php_dom_domstringlist_class_functions, dom_domstringlist_class_entry);
zend_hash_init(&dom_domstringlist_prop_handlers, 0, NULL, NULL, 1);
@@ -637,13 +610,30 @@ PHP_MINIT_FUNCTION(dom)
REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ENUMERATION", XML_ATTRIBUTE_ENUMERATION, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NOTATION", XML_ATTRIBUTE_NOTATION, CONST_CS | CONST_PERSISTENT);
+ /* domException Codes */
+ REGISTER_LONG_CONSTANT("DOM_INDEX_SIZE_ERR", INDEX_SIZE_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOMSTRING_SIZE_ERR", DOMSTRING_SIZE_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_HIERARCHY_REQUEST_ERR", HIERARCHY_REQUEST_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_WRONG_DOCUMENT_ERR", WRONG_DOCUMENT_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_INVALID_CHARACTER_ERR", INVALID_CHARACTER_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_NO_DATA_ALLOWED_ERR", NO_DATA_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_NO_MODIFICATION_ALLOWED_ERR", NO_MODIFICATION_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_NOT_FOUND_ERR", NOT_FOUND_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_NOT_SUPPORTED_ERR", NOT_SUPPORTED_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_INUSE_ATTRIBUTE_ERR", INUSE_ATTRIBUTE_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_INVALID_STATE_ERR", INVALID_STATE_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_SYNTAX_ERR", SYNTAX_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_INVALID_MODIFICATION_ERR", INVALID_MODIFICATION_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_NAMESPACE_ERR", NAMESPACE_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_INVALID_ACCESS_ERR", INVALID_ACCESS_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_VALIDATION_ERR", VALIDATION_ERR, CONST_CS | CONST_PERSISTENT);
+
xmlInitParser();
return SUCCESS;
}
/* }}} */
-/* {{{ */
PHP_MINFO_FUNCTION(dom)
{
php_info_print_table_start();
@@ -661,7 +651,6 @@ PHP_MINFO_FUNCTION(dom)
#endif
php_info_print_table_end();
}
-/* }}} */
PHP_MSHUTDOWN_FUNCTION(dom)
{
@@ -698,7 +687,6 @@ PHP_MSHUTDOWN_FUNCTION(dom)
return SUCCESS;
}
-/* {{{ node_list_unlink */
void node_list_unlink(xmlNodePtr node TSRMLS_DC)
{
dom_object *wrapper;
@@ -728,10 +716,7 @@ void node_list_unlink(xmlNodePtr node TSRMLS_DC)
node = node->next;
}
}
-/* }}} end node_list_unlink */
-
-/* {{{ void dom_node_free(xmlNodePtr node) */
void dom_node_free(xmlNodePtr node)
{
if(node) {
@@ -766,9 +751,7 @@ void dom_node_free(xmlNodePtr node)
}
}
}
-/* }}} end dom_node_free */
-/* {{{ node_free_list */
void node_free_list(xmlNodePtr node TSRMLS_DC)
{
xmlNodePtr curnode;
@@ -803,9 +786,7 @@ void node_free_list(xmlNodePtr node TSRMLS_DC)
}
}
}
-/* }}} end node_free_list */
-/* {{{ node_free_resource */
void node_free_resource(xmlNodePtr node TSRMLS_DC)
{
if (!node) {
@@ -837,17 +818,13 @@ void node_free_resource(xmlNodePtr node TSRMLS_DC)
}
}
}
-/* }}} */
-/* {{{ dom_objects_clone */
void dom_objects_clone(void *object, void **object_clone TSRMLS_DC)
{
/* TODO */
}
-/* }}} */
#if defined(LIBXML_XPATH_ENABLED)
-/* {{{ dom_xpath_objects_dtor */
void dom_xpath_objects_dtor(void *object, zend_object_handle handle TSRMLS_DC)
{
dom_object *intern = (dom_object *)object;
@@ -863,10 +840,8 @@ void dom_xpath_objects_dtor(void *object, zend_object_handle handle TSRMLS_DC)
efree(object);
}
-/* }}} */
#endif
-/* {{{ dom_objects_dtor */
void dom_objects_dtor(void *object, zend_object_handle handle TSRMLS_DC)
{
dom_object *intern = (dom_object *)object;
@@ -887,9 +862,7 @@ void dom_objects_dtor(void *object, zend_object_handle handle TSRMLS_DC)
efree(object);
}
-/* }}} */
-/* {{{ dom_objects_set_class */
static dom_object* dom_objects_set_class(zend_class_entry *class_type TSRMLS_DC)
{
zend_class_entry *base_class;
@@ -917,9 +890,7 @@ static dom_object* dom_objects_set_class(zend_class_entry *class_type TSRMLS_DC)
return intern;
}
-/* }}} */
-/* {{{ dom_objects_new */
zend_object_value dom_objects_new(zend_class_entry *class_type TSRMLS_DC)
{
zend_object_value retval;
@@ -936,7 +907,6 @@ zend_object_value dom_objects_new(zend_class_entry *class_type TSRMLS_DC)
/* }}} */
#if defined(LIBXML_XPATH_ENABLED)
-/* {{{ zend_object_value dom_xpath_objects_new(zend_class_entry *class_type TSRMLS_DC) */
zend_object_value dom_xpath_objects_new(zend_class_entry *class_type TSRMLS_DC)
{
zend_object_value retval;
@@ -950,10 +920,8 @@ zend_object_value dom_xpath_objects_new(zend_class_entry *class_type TSRMLS_DC)
return retval;
}
-/* }}} */
#endif
-/* {{{ php_dom_create_object */
zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *wrapper_in, zval *return_value, dom_object *domobj TSRMLS_DC)
{
zval *wrapper;
@@ -1066,14 +1034,12 @@ zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *wrapper_in, zval *
php_dom_set_object(intern, (void *) obj TSRMLS_CC);
return (wrapper);
}
-/* }}} end php_domobject_new */
void php_dom_create_implementation(zval **retval TSRMLS_DC) {
object_init_ex(*retval, dom_domimplementation_class_entry);
}
-/* {{{ int dom_hierarchy(xmlNodePtr parent, xmlNodePtr child) */
int dom_hierarchy(xmlNodePtr parent, xmlNodePtr child)
{
xmlNodePtr nodep;
@@ -1093,9 +1059,7 @@ int dom_hierarchy(xmlNodePtr parent, xmlNodePtr child)
return SUCCESS;
}
-/* }}} end dom_hierarchy */
-/* {{{ dom_has_feature(char *feature, char *version) */
int dom_has_feature(char *feature, char *version)
{
int retval = 0;
@@ -1107,9 +1071,7 @@ int dom_has_feature(char *feature, char *version)
return retval;
}
-/* }}} end dom_has_feature */
-/* {{{ void dom_element_get_elements_by_tag_name_ns_raw(xmlNodePtr nodep, char *ns, char *local, zval **retval TSRMLS_DC) */
void dom_get_elements_by_tag_name_ns_raw(xmlNodePtr nodep, char *ns, char *local, zval **retval, dom_object *intern TSRMLS_DC)
{
dom_object *wrapper;
@@ -1132,10 +1094,7 @@ void dom_get_elements_by_tag_name_ns_raw(xmlNodePtr nodep, char *ns, char *local
nodep = nodep->next;
}
}
-/* }}} end dom_element_get_elements_by_tag_name_ns_raw */
-
-/* {{{ void dom_normalize (xmlNodePtr nodep TSRMLS_DC) */
void dom_normalize (xmlNodePtr nodep TSRMLS_DC)
{
xmlNodePtr child, nextp, newnextp;
@@ -1178,10 +1137,7 @@ void dom_normalize (xmlNodePtr nodep TSRMLS_DC)
child = child->next;
}
}
-/* }}} end dom_normalize */
-
-/* {{{ void dom_set_old_ns(xmlDoc *doc, xmlNs *ns) */
void dom_set_old_ns(xmlDoc *doc, xmlNs *ns) {
xmlNs *cur;
@@ -1205,7 +1161,6 @@ void dom_set_old_ns(xmlDoc *doc, xmlNs *ns) {
}
cur->next = ns;
}
-/* }}} end dom_set_old_ns */
int dom_check_qname(char *qname, char **localname, char **prefix, int uri_len, int name_len) {
int errorcode = 0;
@@ -1225,7 +1180,6 @@ int dom_check_qname(char *qname, char **localname, char **prefix, int uri_len, i
return errorcode;
}
-/* {{{ xmlNsPtr dom_get_ns(xmlNodePtr nodep, char *uri, int *errorcode, char *prefix) */
xmlNsPtr dom_get_ns(xmlNodePtr nodep, char *uri, int *errorcode, char *prefix) {
xmlNsPtr nsptr = NULL;
@@ -1242,9 +1196,7 @@ xmlNsPtr dom_get_ns(xmlNodePtr nodep, char *uri, int *errorcode, char *prefix) {
return nsptr;
}
-/* }}} end dom_get_ns */
-/* {{{ xmlNsPtr dom_get_nsdecl(xmlNode *node, xmlChar *localName) */
xmlNsPtr dom_get_nsdecl(xmlNode *node, xmlChar *localName) {
xmlNsPtr cur;
xmlNs *ret = NULL;
@@ -1272,7 +1224,6 @@ xmlNsPtr dom_get_nsdecl(xmlNode *node, xmlChar *localName) {
}
return ret;
}
-/* }}} end dom_get_nsdecl */
#endif /* HAVE_DOM */