[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
sniper Wed Mar 28 16:22:45 2001 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: Fixed bug: #10040. Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.34 php4/ext/domxml/php_domxml.c:1.35 --- php4/ext/domxml/php_domxml.c:1.34 Mon Mar 26 13:42:01 2001 +++ php4/ext/domxml/php_domxml.cWed Mar 28 16:22:45 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.34 2001/03/26 21:42:01 sniper Exp $ */ +/* $Id: php_domxml.c,v 1.35 2001/03/29 00:22:45 sniper Exp $ */ #include "php.h" @@ -110,7 +110,7 @@ static function_entry php_domxmldoc_class_functions[] = { -// PHP_FALIAS(domdocument, xmldoc, NULL) +/* PHP_FALIAS(domdocument, xmldoc, NULL) */ {"domdocument", PHP_FN(xmldoc), NULL}, PHP_FALIAS(doctype, domxml_doc_doctype, NULL) PHP_FALIAS(implementation, domxml_doc_implementation, NULL) @@ -493,8 +493,8 @@ php_error(E_ERROR, "Underlying object missing"); } obj = zend_list_find(Z_LVAL_PP(handle), type); -// The following test should be replaced with search in all parents - if (!obj) { // || ((type != rsrc_type1) (type != rsrc_type2))) { +/* The following test should be replaced with search in all parents */ + if (!obj) { /* || ((type != rsrc_type1) (type != rsrc_type2))) { */ php_error(E_ERROR, "Underlying object missing or of invalid type"); } @@ -1737,9 +1737,10 @@ RETURN_FALSE; } -// rv = php_domobject_new(node, ret); -// SEPARATE_ZVAL(rv); -// *return_value = *rv; +/* rv = php_domobject_new(node, ret); + SEPARATE_ZVAL(rv); + *return_value = *rv; +*/ } /* }}} */ @@ -2101,7 +2102,7 @@ } /* }}} */ -/* {{{ proto object domxml_add_root([int doc_handle,] string name) +/* {{{ proto object domxml_add_root(string name) Adds root node to document */ PHP_FUNCTION(domxml_add_root) { @@ -2110,19 +2111,20 @@ xmlNode *nodep; int ret; - if (ZEND_NUM_ARGS() == 1 || getParameters(ht, 1, name)) { - id = getThis(); - docp = php_dom_get_object(id, le_domxmldocp, 0); - } else { + if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, name)==FAILURE) { WRONG_PARAM_COUNT; } + + id = getThis(); + docp = php_dom_get_object(id, le_domxmldocp, 0); convert_to_string(name); - + nodep = xmlNewDocNode(docp, NULL, name-value.str.val, NULL); if (!nodep) { RETURN_FALSE; } -// xmlDocSetRootElement(docp, nodep); + + xmlDocSetRootElement(docp, nodep); rv = php_domobject_new(nodep, ret); SEPARATE_ZVAL(rv); *return_value = *rv; @@ -2177,13 +2179,13 @@ pattr = php_domobject_new((xmlNodePtr) ns, ret); SEPARATE_ZVAL(pattr); -// if(!ret) { +/* if(!ret) { */ if(ns-href) add_property_stringl(pattr, "href", (char *) ns-href, strlen(ns-href), 1); if(ns-prefix) add_property_stringl(pattr, "prefix", (char *) ns-prefix, strlen(ns-prefix), 1); add_property_long(pattr, "type", ns-type); -// } +/* } */ zend_hash_next_index_insert((*attributes)-value.ht, pattr, sizeof(zval *), NULL); ns = ns-next; } @@ -2205,7 +2207,7 @@ if (!attr) { return -1; } -// MAKE_STD_ZVAL(*attributes); /* could be a problem when node_attribute() is called from domxml_attributes */ +/* MAKE_STD_ZVAL(*attributes); */ /* could be a problem when node_attribute() is +called from domxml_attributes */ /* create an php array for the children */ /* MAKE_STD_ZVAL(*attributes); *//* Don't do this if *attributes are the return_value */ @@ -2218,10 +2220,10 @@ int ret; pattr = php_domobject_new((xmlNodePtr) attr, ret); -// if(0 = (n = node_children(children, attr-children))) { -// zend_hash_update(pattr-value.obj.properties, "children", sizeof("children"), (void *) children, sizeof(zval *), NULL); -// } - add_property_string(pattr, "name", (char *) (attr-name), 1); +/* if(0 = (n = node_children(children, attr-children))) { + zend_hash_update(pattr-value.obj.properties, "children", +sizeof("children"), (void *) children, sizeof(zval *), NULL); + } +*/ add_property_string(pattr, "name", (char *) (attr-name), 1); add_property_string(pattr, "value", xmlNodeGetContent((xmlNodePtr) attr), 1); zend_hash_next_index_insert((*attributes)-value.ht, pattr, sizeof(zval *), NULL);
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
sniper Mon Mar 26 13:42:02 2001 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: Fixed a typo. Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.33 php4/ext/domxml/php_domxml.c:1.34 --- php4/ext/domxml/php_domxml.c:1.33 Wed Mar 21 22:58:13 2001 +++ php4/ext/domxml/php_domxml.cMon Mar 26 13:42:01 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.33 2001/03/22 06:58:13 steinm Exp $ */ +/* $Id: php_domxml.c,v 1.34 2001/03/26 21:42:01 sniper Exp $ */ #include "php.h" @@ -667,12 +667,12 @@ return(wrapper); } -PHP_MINIT_FUNCTION(domxml) +PHP_RINIT_FUNCTION(domxml) { return SUCCESS; } -PHP_RINIT_FUNCTION(domxml) +PHP_MINIT_FUNCTION(domxml) { zend_class_entry ce; le_domxmldocp = zend_register_list_destructors_ex(php_free_xml_doc, NULL, "domdocument", module_number); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
When I still remember..I'm getting a lot of error messages into my error_log, e.g.: Unknown(0) : Warning - Constant xpath_boolean already defined And I think you have PHP_MINIT and PHP_RINIT mixed.. ie. Index: php_domxml.c === RCS file: /repository/php4/ext/domxml/php_domxml.c,v retrieving revision 1.33 diff -u -r1.33 php_domxml.c --- php_domxml.c2001/03/22 06:58:13 1.33 +++ php_domxml.c2001/03/22 12:13:37 @@ -667,12 +667,12 @@ return(wrapper); } -PHP_MINIT_FUNCTION(domxml) +PHP_RINIT_FUNCTION(domxml) { return SUCCESS; } -PHP_RINIT_FUNCTION(domxml) +PHP_MINIT_FUNCTION(domxml) { zend_class_entry ce; le_domxmldocp = zend_register_list_destructors_ex(php_free_xml_doc, NULL, "domdocument", module_number); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
steinm Wed Mar 21 22:58:13 2001 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: - fixed some bugs with xpath Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.32 php4/ext/domxml/php_domxml.c:1.33 --- php4/ext/domxml/php_domxml.c:1.32 Tue Mar 20 21:45:40 2001 +++ php4/ext/domxml/php_domxml.cWed Mar 21 22:58:13 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.32 2001/03/21 05:45:40 steinm Exp $ */ +/* $Id: php_domxml.c,v 1.33 2001/03/22 06:58:13 steinm Exp $ */ #include "php.h" @@ -97,13 +97,13 @@ PHP_FE(domxml_new_xmldoc, NULL) PHP_FALIAS(new_xmldoc, domxml_new_xmldoc, NULL) #if defined(LIBXML_XPATH_ENABLED) - PHP_FE(xpath_new_context, NULL) +/* PHP_FE(xpath_new_context, NULL) PHP_FE(xpath_eval, NULL) - PHP_FE(xpath_eval_expression, NULL) + PHP_FE(xpath_eval_expression, NULL) */ #endif #if defined(LIBXML_XPTR_ENABLED) - PHP_FE(xptr_new_context, NULL) - PHP_FE(xptr_eval, NULL) +/* PHP_FE(xptr_new_context, NULL) + PHP_FE(xptr_eval, NULL) */ #endif {NULL, NULL, NULL} }; @@ -296,24 +296,29 @@ static void php_free_xml_doc(zend_rsrc_list_entry *rsrc) { xmlDoc *doc = (xmlDoc *)rsrc-ptr; - xmlFreeDoc(doc); +/* fprintf(stderr, "Freeing document: %s\n", doc-name); */ + if(doc) + xmlFreeDoc(doc); } -void _free_node(zend_rsrc_list_entry *rsrc) { -/*fprintf(stderr, "Freeing node: %s\n", tmp-name);*/ +void php_free_xml_node(zend_rsrc_list_entry *rsrc) { + xmlNodePtr node = (xmlNodePtr) rsrc-ptr; +/* fprintf(stderr, "Freeing node: %s\n", node-name); */ } #if defined(LIBXML_XPATH_ENABLED) static void php_free_xpath_context(zend_rsrc_list_entry *rsrc) { xmlXPathContextPtr ctx = (xmlXPathContextPtr)rsrc-ptr; - xmlXPathFreeContext(ctx); + if(ctx) + xmlXPathFreeContext(ctx); } static void php_free_xpath_object(zend_rsrc_list_entry *rsrc) { xmlXPathObjectPtr obj = (xmlXPathObjectPtr)rsrc-ptr; - xmlXPathFreeObject(obj); + if(obj) + xmlXPathFreeObject(obj); } #endif @@ -390,7 +395,7 @@ MAKE_STD_ZVAL(wrapper); /* fprintf(stderr, "Adding new XPath Object\n"); */ object_init_ex(wrapper, xpathobject_class_entry); - rsrc_type = le_xpathctxp; + rsrc_type = le_xpathobjectp; php_xpath_set_object(wrapper, (void *) obj, rsrc_type); return(wrapper); @@ -674,7 +679,7 @@ /* Freeing the document contains freeing the complete tree. Therefore nodes, attributes etc. may not be freed seperately. */ - le_domxmlnodep = zend_register_list_destructors_ex(_free_node, NULL, "domnode", module_number); + le_domxmlnodep = zend_register_list_destructors_ex(php_free_xml_node, NULL, +"domnode", module_number); le_domxmlattrp = zend_register_list_destructors_ex(NULL, NULL, "domattribute", module_number); #if defined(LIBXML_XPATH_ENABLED) le_xpathctxp = zend_register_list_destructors_ex(php_free_xpath_context, NULL, "xpathcontext", module_number); @@ -2117,7 +2122,7 @@ if (!nodep) { RETURN_FALSE; } - xmlDocSetRootElement(docp, nodep); +// xmlDocSetRootElement(docp, nodep); rv = php_domobject_new(nodep, ret); SEPARATE_ZVAL(rv); *return_value = *rv; @@ -2398,9 +2403,8 @@ rv = php_xpathobject_new(xpathobjp, ret); SEPARATE_ZVAL(rv); - *return_value = *rv; - add_property_long(return_value, "type", xpathobjp-type); + add_property_long(rv, "type", xpathobjp-type); switch(xpathobjp-type) { case XPATH_UNDEFINED: break; @@ -2411,11 +2415,11 @@ MAKE_STD_ZVAL(arr); if (array_init(arr) == FAILURE) { - xmlXPathFreeObject(xpathobjp); + zval_dtor(rv); RETURN_FALSE; } if(NULL == (nodesetp = xpathobjp-nodesetval)) { - xmlXPathFreeObject(xpathobjp); + zval_dtor(rv); RETURN_FALSE; } @@ -2428,17 +2432,17 @@ child = php_domobject_new(node, retnode); zend_hash_next_index_insert(arr-value.ht, child, sizeof(zval *), NULL); } - zend_hash_update(return_value-value.obj.properties, "nodeset", sizeof("nodeset"), (void *) arr, sizeof(zval *), NULL); + zend_hash_update(rv-value.obj.properties, "nodeset", +sizeof("nodeset"), (void *) arr, sizeof(zval *), NULL); break;
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c php_domxml.h
steinm Tue Mar 20 07:01:14 2001 EDT Modified files: /php4/ext/domxmlphp_domxml.c php_domxml.h Log: - complete rewrite of domxml module. It is now mostly conform to DOM Level 2 though some classes and methods are still missing Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.28 php4/ext/domxml/php_domxml.c:1.29 --- php4/ext/domxml/php_domxml.c:1.28 Sun Feb 25 22:06:53 2001 +++ php4/ext/domxml/php_domxml.cTue Mar 20 07:01:13 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.28 2001/02/26 06:06:53 andi Exp $ */ +/* $Id: php_domxml.c,v 1.29 2001/03/20 15:01:13 steinm Exp $ */ #include "php.h" @@ -24,33 +24,46 @@ #if HAVE_DOMXML #include "ext/standard/info.h" -/*#define newcode*/ #define PHP_XPATH 1 #define PHP_XPTR 2 static int le_domxmldocp; +static int le_domxmldoctypep; static int le_domxmldtdp; static int le_domxmlnodep; +static int le_domxmlelementp; static int le_domxmlattrp; -/* static int le_domxmlnsp; */ +static int le_domxmlcdatap; +static int le_domxmltextp; +static int le_domxmlpip; +static int le_domxmlcommentp; +static int le_domxmlentityp; +static int le_domxmlnsp; #if defined(LIBXML_XPATH_ENABLED) static int le_xpathctxp; static int le_xpathobjectp; -static zend_class_entry *xpathctx_class_entry_ptr; -static zend_class_entry *xpathobject_class_entry_ptr; #endif -static zend_class_entry *domxmldoc_class_entry_ptr; -static zend_class_entry *domxmldtd_class_entry_ptr; -static zend_class_entry *domxmlnode_class_entry_ptr; -static zend_class_entry *domxmlattr_class_entry_ptr; -static zend_class_entry *domxmlns_class_entry_ptr; - -#ifdef newcode -static zend_class_entry *domxmltestnode_class_entry_ptr; +zend_class_entry *domxmldoc_class_entry; +zend_class_entry *domxmldoctype_class_entry; +zend_class_entry *domxmlelement_class_entry; +zend_class_entry *domxmldtd_class_entry; +zend_class_entry *domxmlnode_class_entry; +zend_class_entry *domxmlattr_class_entry; +zend_class_entry *domxmlcdata_class_entry; +zend_class_entry *domxmltext_class_entry; +zend_class_entry *domxmlpi_class_entry; +zend_class_entry *domxmlcomment_class_entry; +zend_class_entry *domxmlnotation_class_entry; +zend_class_entry *domxmlentity_class_entry; +zend_class_entry *domxmlns_class_entry; +#if defined(LIBXML_XPATH_ENABLED) +zend_class_entry *xpathctx_class_entry; +zend_class_entry *xpathobject_class_entry; #endif + static int node_attributes(zval **attributes, xmlNode *nodep); static int node_children(zval **children, xmlNode *nodep); @@ -58,19 +71,26 @@ PHP_FE(xmldoc, NULL) PHP_FE(xmldocfile, NULL) PHP_FE(xmltree, NULL) - PHP_FE(domxml_root, NULL) + PHP_FALIAS(domxml_root, domxml_doc_document_element, NULL) PHP_FE(domxml_add_root, NULL) PHP_FE(domxml_dumpmem, NULL) - PHP_FE(domxml_attributes, NULL) - PHP_FE(domxml_get_attribute,NULL) - PHP_FALIAS(domxml_getattr, domxml_get_attribute, NULL) - PHP_FE(domxml_set_attribute,NULL) - PHP_FALIAS(domxml_setattr, domxml_set_attribute, NULL) - PHP_FE(domxml_children, NULL) - PHP_FE(domxml_new_child,NULL) + PHP_FE(domxml_node_attributes, NULL) + PHP_FALIAS(domxml_attributes, domxml_node_attributes, NULL) + PHP_FE(domxml_elem_get_attribute, NULL) + PHP_FALIAS(domxml_get_attribute,domxml_elem_get_attribute, NULL) + PHP_FALIAS(domxml_getattr, domxml_elem_get_attribute, NULL) + PHP_FE(domxml_elem_set_attribute, NULL) + PHP_FALIAS(domxml_set_attribute,domxml_elem_set_attribute, NULL) + PHP_FALIAS(domxml_setattr, domxml_elem_set_attribute, NULL) + PHP_FE(domxml_node_children,NULL) + PHP_FALIAS(domxml_children, domxml_node_children, NULL) + PHP_FE(domxml_node_new_child, NULL) + PHP_FALIAS(domxml_new_child,domxml_node_new_child, NULL) PHP_FE(domxml_node, NULL) - PHP_FE(domxml_unlink_node, NULL) - PHP_FE(domxml_set_content, NULL) + PHP_FE(domxml_node_unlink_node, NULL) + PHP_FALIAS(domxml_unlink_node, domxml_node_unlink_node, NULL) + PHP_FE(domxml_node_set_content, NULL) + PHP_FALIAS(set_content, domxml_node_set_content,NULL) PHP_FE(domxml_new_xmldoc, NULL) PHP_FALIAS(new_xmldoc, domxml_new_xmldoc, NULL) #if defined(LIBXML_XPATH_ENABLED) @@ -86,41 +106,151 @@ }; -static zend_function_entry php_domxmldoc_class_functions[] = { - PHP_FALIAS(root,domxml_root,NULL) - PHP_FALIAS(children,domxml_children,NULL) +static function_entry php_domxmldoc_class_functions[] = { +// PHP_FALIAS(domdocument, xmldoc, NULL) + {"domdocument", PHP_FN(xmldoc), NULL}, + PHP_FALIAS(doctype, domxml_doc_doctype,
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
sbergmann Tue Mar 20 09:04:45 2001 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: Nuke another warning. Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.30 php4/ext/domxml/php_domxml.c:1.31 --- php4/ext/domxml/php_domxml.c:1.30 Tue Mar 20 08:20:42 2001 +++ php4/ext/domxml/php_domxml.cTue Mar 20 09:04:45 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.30 2001/03/20 16:20:42 steinm Exp $ */ +/* $Id: php_domxml.c,v 1.31 2001/03/20 17:04:45 sbergmann Exp $ */ #include "php.h" @@ -1620,7 +1620,6 @@ { zval *id, *arg1; xmlNode *nodep; - char *value; if ((ZEND_NUM_ARGS() == 1) getParameters(ht, 1, arg1) == SUCCESS) { id = getThis(); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c php_domxml.h
steinm Tue Mar 20 21:45:41 2001 EDT Modified files: /php4/ext/domxmlphp_domxml.c php_domxml.h Log: - added EntityReference and Notation class - fixed handling of PI nodes - implemented more class functions Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.31 php4/ext/domxml/php_domxml.c:1.32 --- php4/ext/domxml/php_domxml.c:1.31 Tue Mar 20 09:04:45 2001 +++ php4/ext/domxml/php_domxml.cTue Mar 20 21:45:40 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.31 2001/03/20 17:04:45 sbergmann Exp $ */ +/* $Id: php_domxml.c,v 1.32 2001/03/21 05:45:40 steinm Exp $ */ #include "php.h" @@ -37,7 +37,9 @@ static int le_domxmltextp; static int le_domxmlpip; static int le_domxmlcommentp; +static int le_domxmlnotationp; static int le_domxmlentityp; +static int le_domxmlentityrefp; static int le_domxmlnsp; #if defined(LIBXML_XPATH_ENABLED) @@ -57,6 +59,7 @@ zend_class_entry *domxmlcomment_class_entry; zend_class_entry *domxmlnotation_class_entry; zend_class_entry *domxmlentity_class_entry; +zend_class_entry *domxmlentityref_class_entry; zend_class_entry *domxmlns_class_entry; #if defined(LIBXML_XPATH_ENABLED) zend_class_entry *xpathctx_class_entry; @@ -126,6 +129,8 @@ PHP_FALIAS(create_processing_instruction, domxml_doc_create_processing_instruction, NULL) PHP_FALIAS(children,domxml_node_children, NULL) PHP_FALIAS(add_root,domxml_add_root,NULL) + PHP_FALIAS(importednode,domxml_doc_imported_node, NULL) + PHP_FALIAS(imported_node, domxml_doc_imported_node, NULL) PHP_FALIAS(dtd, domxml_intdtd, NULL) PHP_FALIAS(dumpmem, domxml_dumpmem, NULL) /* PHP_FALIAS(createcdatasection, domxml_create_cdata_section,NULL) @@ -228,11 +233,15 @@ }; static zend_function_entry php_domxmlnotation_class_functions[] = { -/* PHP_FALIAS(publicid,domxml_notation_public_id, NULL) + PHP_FALIAS(publicid,domxml_notation_public_id, NULL) PHP_FALIAS(public_id, domxml_notation_public_id, NULL) PHP_FALIAS(systemid,domxml_notation_system_id, NULL) PHP_FALIAS(system_id, domxml_notation_system_id, NULL) -*/ {NULL, NULL, NULL} + {NULL, NULL, NULL} +}; + +static zend_function_entry php_domxmlentityref_class_functions[] = { + {NULL, NULL, NULL} }; static zend_function_entry php_domxmlentity_class_functions[] = { @@ -480,9 +489,9 @@ } obj = zend_list_find(Z_LVAL_PP(handle), type); // The following test should be replaced with search in all parents -// if (!obj || ((type != rsrc_type1) (type != rsrc_type2))) { -// php_error(E_ERROR, "Underlying object missing or of invalid type"); -// } + if (!obj) { // || ((type != rsrc_type1) (type != rsrc_type2))) { + php_error(E_ERROR, "Underlying object missing or of invalid type"); + } return obj; } @@ -567,7 +576,26 @@ add_property_stringl(wrapper, "content", (char *) content, strlen(content), 1); break; } - case XML_ENTITY_REF_NODE: + case XML_PI_NODE: { + xmlNodePtr nodep = obj; + object_init_ex(wrapper, domxmlpi_class_entry); + rsrc_type = le_domxmlpip; + content = xmlNodeGetContent(nodep); + add_property_stringl(wrapper, "target", (char *) nodep-name, +strlen(nodep-name), 1); + if(content) + add_property_stringl(wrapper, "data", (char *) +content, strlen(content), 1); + break; + } + case XML_ENTITY_REF_NODE: { + xmlNodePtr nodep = obj; + object_init_ex(wrapper, domxmlentityref_class_entry); + rsrc_type = le_domxmlentityrefp; + content = xmlNodeGetContent(nodep); + add_property_stringl(wrapper, "name", (char *) nodep-name, +strlen(nodep-name), 1); + if(content) + add_property_stringl(wrapper, "content", (char *) +content, strlen(content), 1); + break; + } case XML_ENTITY_DECL: case XML_ELEMENT_DECL: { xmlNodePtr nodep = obj; @@ -634,67 +662,6 @@ return(wrapper); } -/* The following has been taken form the gnome gdome module */ -/* This is a separate implementation that avoids the roundtrip entity - encoding/decoding of the current (2000-01-06) gnome-xml - implementation, largely because that depends on node != NULL, which -
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c php_domxml.h
steinm Thu Feb 8 07:12:16 2001 EDT Modified files: /php4/ext/domxmlphp_domxml.c php_domxml.h Log: - add domxml_unlink_node(), not tested Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.26 php4/ext/domxml/php_domxml.c:1.27 --- php4/ext/domxml/php_domxml.c:1.26 Fri Jan 26 00:15:57 2001 +++ php4/ext/domxml/php_domxml.cThu Feb 8 07:12:16 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.26 2001/01/26 08:15:57 steinm Exp $ */ +/* $Id: php_domxml.c,v 1.27 2001/02/08 15:12:16 steinm Exp $ */ #include "php.h" @@ -69,6 +69,7 @@ PHP_FE(domxml_children, NULL) PHP_FE(domxml_new_child,NULL) PHP_FE(domxml_node, NULL) + PHP_FE(domxml_unlink_node, NULL) PHP_FE(domxml_set_content, NULL) PHP_FE(domxml_new_xmldoc, NULL) PHP_FALIAS(new_xmldoc, domxml_new_xmldoc, NULL) @@ -115,12 +116,15 @@ PHP_FALIAS(set_attribute, domxml_set_attribute, NULL) PHP_FALIAS(attributes, domxml_attributes, NULL) PHP_FALIAS(node,domxml_node,NULL) + PHP_FALIAS(unlink, domxml_unlink_node, NULL) PHP_FALIAS(set_content, domxml_set_content, NULL) {NULL, NULL, NULL} }; #if defined(LIBXML_XPATH_ENABLED) static zend_function_entry php_xpathctx_class_functions[] = { + PHP_FALIAS(xpath_eval, xpath_eval, NULL) + PHP_FALIAS(xpath_eval_expression, xpath_eval_expression, NULL) {NULL, NULL, NULL} }; @@ -699,6 +703,40 @@ zend_hash_next_index_insert(return_value-value.ht, child, sizeof(zval *), NULL); last = last-next; } +} +/* }}} */ + +/* {{{ proto object domxml_unlink_node([int node]) + Deletes node */ +PHP_FUNCTION(domxml_unlink_node) +{ + zval *id, **tmp; + xmlNode *nodep, *last; + int ret; + + if (ZEND_NUM_ARGS() == 0) { + id = getThis(); + if (id) { + if (zend_hash_find(id-value.obj.properties, "node", +sizeof("node"), (void **)tmp) == FAILURE) { + php_error(E_WARNING, "unable to find my handle +property"); + RETURN_FALSE; + } + ZEND_FETCH_RESOURCE(nodep,xmlNodePtr,tmp,-1, "DomNode", +le_domxmlnodep) + } else { + RETURN_FALSE; + } + } else if ((ZEND_NUM_ARGS() != 1) || getParameters(ht, 1, id) == FAILURE) { + WRONG_PARAM_COUNT; + } else { + if (zend_hash_find(id-value.obj.properties, "node", sizeof("node"), +(void **)tmp) == FAILURE) { + php_error(E_WARNING, "unable to find my handle property"); + RETURN_FALSE; + } + ZEND_FETCH_RESOURCE(nodep,xmlNodePtr,tmp,-1, "DomNode", le_domxmlnodep) + } + + xmlUnlinkNode(nodep); + RETURN_TRUE; } /* }}} */ Index: php4/ext/domxml/php_domxml.h diff -u php4/ext/domxml/php_domxml.h:1.20 php4/ext/domxml/php_domxml.h:1.21 --- php4/ext/domxml/php_domxml.h:1.20 Fri Jan 26 00:15:57 2001 +++ php4/ext/domxml/php_domxml.hThu Feb 8 07:12:16 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.h,v 1.20 2001/01/26 08:15:57 steinm Exp $ */ +/* $Id: php_domxml.h,v 1.21 2001/02/08 15:12:16 steinm Exp $ */ #ifndef PHP_DOMXML_H #define PHP_DOMXML_H @@ -55,6 +55,7 @@ PHP_FUNCTION(domxml_last_child); PHP_FUNCTION(domxml_parent); PHP_FUNCTION(domxml_node); +PHP_FUNCTION(domxml_unlink_node); PHP_FUNCTION(domxml_new_child); PHP_FUNCTION(domxml_set_content); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
sniper Fri Jan 12 08:49:07 2001 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: - Fixed a possible crash bug in xmltree(). # PR: #7052 Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.24 php4/ext/domxml/php_domxml.c:1.25 --- php4/ext/domxml/php_domxml.c:1.24 Fri Jan 5 06:34:15 2001 +++ php4/ext/domxml/php_domxml.cFri Jan 12 08:49:06 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.24 2001/01/05 14:34:15 andi Exp $ */ +/* $Id: php_domxml.c,v 1.25 2001/01/12 16:49:06 sniper Exp $ */ #include "php.h" @@ -1406,8 +1406,10 @@ zend_hash_next_index_insert((*children)-value.ht, child, sizeof(zval *), NULL); /* Add name, content and type as properties */ - add_property_stringl(child, "name", (char *) last-name, strlen(last-name), 1); - add_property_long(child, "type", last-type); + if(last-name) + add_property_stringl(child, "name", (char *) last-name, +strlen(last-name), 1); + if(last-type) + add_property_long(child, "type", last-type); content = xmlNodeGetContent(last); if(content) add_property_stringl(child, "content", (char *) content, strlen(content), 1); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]