cvs: /php4 NEWS /php4/ext/domxml config.m4 domxml.c
| From: | Uwe Steinmann | Date: | Wed, 15 Mar 2000 15:08:38 +0000 |
| Subject: | cvs: /php4 NEWS /php4/ext/domxml config.m4 domxml.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-12165@lists.php.net to get a copy of this message | ||
steinm Wed Mar 15 07:08:38 2000 EDT
Modified files:
/php4 NEWS
/php4/ext/domxml config.m4 domxml.c
Log:
- support for libxml 2.0 beta
Index: php4/NEWS
diff -u php4/NEWS:1.171 php4/NEWS:1.172
--- php4/NEWS:1.171 Tue Mar 14 18:12:02 2000
+++ php4/NEWS Wed Mar 15 07:08:08 2000
@@ -2,6 +2,8 @@
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
???, Version 4.0 Beta 5
+- domxml now supports libxml 2.0 Beta and drops support for older versions,
+ due to massive changes in libxml
- fixed possible crash in unserialize() if serialized data was
corrupted. (Thies)
- Changed $HTTP_STATE_VARS to $HTTP_SESSION_VARS. Use only the latter
Index: php4/ext/domxml/config.m4
diff -u php4/ext/domxml/config.m4:1.7 php4/ext/domxml/config.m4:1.8
--- php4/ext/domxml/config.m4:1.7 Wed Mar 15 00:09:14 2000
+++ php4/ext/domxml/config.m4 Wed Mar 15 07:08:08 2000
@@ -1,4 +1,4 @@
-dnl $Id: config.m4,v 1.7 2000/03/15 08:09:14 steinm Exp $
+dnl $Id: config.m4,v 1.8 2000/03/15 15:08:08 steinm Exp $
AC_MSG_CHECKING(whether to include DOM support)
AC_ARG_WITH(dom,
@@ -22,8 +22,7 @@
AC_ADD_INCLUDE(/usr/local/include)
;;
*)
- test -f $withval/include/gnome-xml/tree.h &&
DOMXML_INCLUDE="$withval/include/gnome-xml"
- test -f $withval/include/tree.h && DOMXML_INCLUDE="$withval/include"
+ test -f $withval/include/gnome-xml/tree.h &&
DOMXML_INCLUDE="$withval/include"
if test -n "$DOMXML_INCLUDE" ; then
AC_MSG_RESULT(yes)
PHP_EXTENSION(domxml)
Index: php4/ext/domxml/domxml.c
diff -u php4/ext/domxml/domxml.c:1.31 php4/ext/domxml/domxml.c:1.32
--- php4/ext/domxml/domxml.c:1.31 Tue Mar 14 12:58:10 2000
+++ php4/ext/domxml/domxml.c Wed Mar 15 07:08:08 2000
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domxml.c,v 1.31 2000/03/14 20:58:10 steinm Exp $ */
+/* $Id: domxml.c,v 1.32 2000/03/15 15:08:08 steinm Exp $ */
#include "php.h"
@@ -370,7 +370,7 @@
object_init_ex(pattr, domxmlattr_class_entry_ptr);
add_property_resource(pattr, "attribute", ret);
add_property_stringl(pattr, "name", (char *) attr->name, strlen(attr->name), 1);
- add_property_stringl(pattr, "content", (char *) attr->val->content,
strlen(attr->val->content), 1);
+// add_property_stringl(pattr, "content", (char *) attr->val->content,
strlen(attr->val->content), 1);
zend_hash_next_index_insert(return_value->value.ht, &pattr, sizeof(zval *), NULL);
attr = attr->next;
}
@@ -548,9 +548,9 @@
same position.
*/
if(nodep->type == XML_DOCUMENT_NODE)
- last = ((xmlDoc *) nodep)->root;
+ last = ((xmlDoc *) nodep)->children;
else
- last = nodep->childs;
+ last = nodep->children;
if (!last) {
RETURN_FALSE;
}
@@ -704,6 +704,10 @@
RETURN_FALSE;
}
+ if(0 > node_attributes(&return_value, nodep))
+ RETURN_FALSE;
+
+#ifdef 0
attr = nodep->properties;
if (!attr) {
RETURN_FALSE;
@@ -718,6 +722,7 @@
add_assoc_string(return_value, (char *) attr->name, attr->val->content, 1);
attr = attr->next;
}
+#endif
}
/* }}} */
@@ -756,7 +761,7 @@
RETURN_FALSE;
}
- last = nodep->root;
+ last = nodep->children;
if (!last) {
RETURN_FALSE;
}
@@ -819,7 +824,7 @@
RETURN_FALSE;
}
- node = docp->root;
+ node = docp->children;
if (!node) {
RETURN_FALSE;
}
@@ -1100,7 +1105,7 @@
if (!node) {
RETURN_FALSE;
}
- docp->root = node;
+ xmlDocSetRootElement(docp, node);
ret = zend_list_insert(node, le_domxmlnodep);
/* construct an object with some methods */
@@ -1170,8 +1175,10 @@
/* construct an object with some methods */
object_init_ex(pattr, domxmlns_class_entry_ptr);
// add_property_resource(pattr, "attribute", ret);
- add_property_stringl(pattr, "href", (char *) ns->href, strlen(ns->href), 1);
- add_property_stringl(pattr, "prefix", (char *) ns->prefix, strlen(ns->prefix),
1);
+ 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;
@@ -1189,6 +1196,8 @@
xmlAttr *attr;
/* Get the children of the current node */
+ if(nodep->type != XML_ELEMENT_NODE)
+ return -1;
attr = nodep->properties;
if (!attr) {
return -1;
@@ -1203,17 +1212,12 @@
while(attr) {
zval *pattr;
MAKE_STD_ZVAL(pattr);
-// ret = zend_list_insert(attr, le_domxmlattrp);
/* construct an object with some methods */
object_init_ex(pattr, domxmlattr_class_entry_ptr);
-// add_property_resource(pattr, "attribute", ret);
add_property_stringl(pattr, "name", (char *) attr->name, strlen(attr->name), 1);
- if(!attr->val->next)
- add_property_stringl(pattr, "content", (char *) attr->val->content,
strlen(attr->val->content), 1);
- else {
- if(0 == node_children(&children, attr->val))
- zend_hash_update(pattr->value.obj.properties, "content",
sizeof("content"), (void *) &children, sizeof(zval *), NULL);
+ if(0 == node_children(&children, attr->children)) {
+ zend_hash_update(pattr->value.obj.properties, "children",
sizeof("children"), (void *) &children, sizeof(zval *), NULL);
}
zend_hash_next_index_insert((*attributes)->value.ht, &pattr, sizeof(zval *), NULL);
attr = attr->next;
@@ -1261,15 +1265,16 @@
// add_property_resource(child, "node", ret);
/* Get the namespace of the current node and add it as a property */
- if(!node_namespace(&namespace, last))
+/* if(!node_namespace(&namespace, last))
zend_hash_update(child->value.obj.properties, "namespace",
sizeof("namespace"), (void *) &namespace, sizeof(zval *), NULL);
+*/
/* Get the attributes of the current node and add it as a property */
if(!node_attributes(&attributes, last))
zend_hash_update(child->value.obj.properties, "attributes",
sizeof("attributes"), (void *) &attributes, sizeof(zval *), NULL);
/* Get recursively the children of the current node and add it as a property */
- if(!node_children(&mchildren, last->childs))
+ if(!node_children(&mchildren, last->children))
zend_hash_update(child->value.obj.properties, "children",
sizeof("children"), (void *) &mchildren, sizeof(zval *), NULL);
last = last->next;
@@ -1307,7 +1312,7 @@
add_property_long(return_value, "type", docp->type);
/* get the root and add as a property to the document */
- root = docp->root;
+ root = docp->children;
if (!root) {
xmlFreeDoc(docp);
RETURN_FALSE;