summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/dom/dom_fe.h1
-rw-r--r--ext/dom/node.c30
2 files changed, 31 insertions, 0 deletions
diff --git a/ext/dom/dom_fe.h b/ext/dom/dom_fe.h
index 111f9e25f3..467fc323fd 100644
--- a/ext/dom/dom_fe.h
+++ b/ext/dom/dom_fe.h
@@ -167,6 +167,7 @@ PHP_FUNCTION(dom_node_set_user_data);
PHP_FUNCTION(dom_node_get_user_data);
PHP_METHOD(domnode, C14N);
PHP_METHOD(domnode, C14NFile);
+PHP_METHOD(domnode, getNodePath);
/* domnodelist methods */
PHP_FUNCTION(dom_nodelist_item);
diff --git a/ext/dom/node.c b/ext/dom/node.c
index 62073ad4d9..5ae4827901 100644
--- a/ext/dom/node.c
+++ b/ext/dom/node.c
@@ -53,6 +53,7 @@ zend_function_entry php_dom_node_class_functions[] = {
PHP_FALIAS(getFeature, dom_node_get_feature, NULL)
PHP_FALIAS(setUserData, dom_node_set_user_data, NULL)
PHP_FALIAS(getUserData, dom_node_get_user_data, NULL)
+ PHP_ME(domnode, getNodePath, NULL, ZEND_ACC_PUBLIC)
PHP_ME(domnode, C14N, NULL, ZEND_ACC_PUBLIC)
PHP_ME(domnode, C14NFile, NULL, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
@@ -1857,3 +1858,32 @@ PHP_METHOD(domnode, C14NFile)
}
#endif
+
+/* {{{ proto int DOMNode::getNodePath()
+ Gets an xpath for a node */
+
+PHP_METHOD(domnode, getNodePath)
+{
+ zval *id;
+ xmlNode *nodep;
+ dom_object *intern;
+ char *value;
+
+
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_node_class_entry) == FAILURE) {
+ return;
+ }
+
+ DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
+ value = xmlGetNodePath(nodep);
+ if (value == NULL) {
+ RETURN_EMPTY_STRING();
+ } else {
+ RETVAL_STRING(value, 1);
+ xmlFree(value);
+ }
+
+
+}
+