{
php_sxe_object *subnode;
- subnode = php_sxe_object_new(sxe_class_entry TSRMLS_CC);
+ subnode = php_sxe_object_new(sxe->zo.ce TSRMLS_CC);
subnode->document = sxe->document;
subnode->document->refcount++;
subnode->nsmapptr = sxe->nsmapptr;
xmlFree(contents);
}
} else {
- subnode = php_sxe_object_new(sxe_class_entry TSRMLS_CC);
+ subnode = php_sxe_object_new(sxe_ref->zo.ce TSRMLS_CC);
subnode->document = sxe_ref->document;
subnode->document->refcount++;
subnode->nsmapptr = sxe_ref->nsmapptr;
xmlNodePtr nodep = NULL;
xmlDocPtr docp = NULL;
- clone = php_sxe_object_new(sxe_class_entry TSRMLS_CC);
+ clone = php_sxe_object_new(sxe->zo.ce TSRMLS_CC);
clone->document = sxe->document;
if (clone->document) {
clone->document->refcount++;
char *filename;
int filename_len;
xmlDocPtr docp;
+ char *classname = "";
+ int classname_len = 0;
+ zend_class_entry *ce= sxe_class_entry;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &filename, &filename_len, &classname, &classname_len) == FAILURE) {
return;
}
if (! docp) {
RETURN_FALSE;
}
+
+ if (classname_len) {
+ zend_class_entry **pce;
+ if (zend_lookup_class(classname, classname_len, &pce TSRMLS_CC) == FAILURE) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s does not exist", classname);
+ }
+ ce = *pce;
+ }
- sxe = php_sxe_object_new(sxe_class_entry TSRMLS_CC);
+ sxe = php_sxe_object_new(ce TSRMLS_CC);
php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, docp TSRMLS_CC);
sxe->nsmapptr = emalloc(sizeof(simplexml_nsmap));
sxe->nsmapptr->nsmap = xmlHashCreate(10);
char *data;
int data_len;
xmlDocPtr docp;
+ char *classname = "";
+ int classname_len = 0;
+ zend_class_entry *ce= sxe_class_entry;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len, &classname, &classname_len) == FAILURE) {
return;
}
RETURN_FALSE;
}
- sxe = php_sxe_object_new(sxe_class_entry TSRMLS_CC);
+ if (classname_len) {
+ zend_class_entry **pce;
+ if (zend_lookup_class(classname, classname_len, &pce TSRMLS_CC) == FAILURE) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s does not exist", classname);
+ }
+ ce = *pce;
+ }
+
+ sxe = php_sxe_object_new(ce TSRMLS_CC);
php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, docp TSRMLS_CC);
sxe->nsmapptr = emalloc(sizeof(simplexml_nsmap));
sxe->nsmapptr->nsmap = xmlHashCreate(10);
zval *node;
php_libxml_node_object *object;
xmlNodePtr nodep = NULL;
+ char *classname = "";
+ int classname_len = 0;
+ zend_class_entry *ce= sxe_class_entry;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &node) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|s", &node, &classname, &classname_len) == FAILURE) {
return;
}
}
if (nodep && nodep->type == XML_ELEMENT_NODE) {
- sxe = php_sxe_object_new(sxe_class_entry TSRMLS_CC);
+ if (classname_len) {
+ zend_class_entry **pce;
+ if (zend_lookup_class(classname, classname_len, &pce TSRMLS_CC) == FAILURE) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s does not exist", classname);
+ }
+ ce = *pce;
+ }
+
+ sxe = php_sxe_object_new(ce TSRMLS_CC);
sxe->document = object->document;
php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, nodep->doc TSRMLS_CC);
sxe->nsmapptr = emalloc(sizeof(simplexml_nsmap));