From: Rob Richards Date: Tue, 13 Jan 2009 18:05:41 +0000 (+0000) Subject: Add method DomNode::getLineNo to return line number for a parsed node X-Git-Tag: php-5.4.0alpha1~191^2~4531 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b879f6a8e5383e1f7352037c3570366e7696740c;p=php Add method DomNode::getLineNo to return line number for a parsed node --- diff --git a/ext/dom/dom_fe.h b/ext/dom/dom_fe.h index 3879b5b7c9..58698f0028 100644 --- a/ext/dom/dom_fe.h +++ b/ext/dom/dom_fe.h @@ -168,6 +168,7 @@ PHP_FUNCTION(dom_node_get_user_data); PHP_METHOD(domnode, C14N); PHP_METHOD(domnode, C14NFile); PHP_METHOD(domnode, getNodePath); +PHP_METHOD(domnode, getLineNo); /* domnodelist methods */ PHP_FUNCTION(dom_nodelist_item); diff --git a/ext/dom/node.c b/ext/dom/node.c index 1971971fc0..9a76b3c432 100644 --- a/ext/dom/node.c +++ b/ext/dom/node.c @@ -106,6 +106,9 @@ ZEND_END_ARG_INFO(); ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_getNodePath, 0, 0, 0) ZEND_END_ARG_INFO(); +ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_getLineNo, 0, 0, 0) +ZEND_END_ARG_INFO(); + ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_C14N, 0, 0, 0) ZEND_ARG_INFO(0, exclusive) ZEND_ARG_INFO(0, with_comments) @@ -149,6 +152,7 @@ const zend_function_entry php_dom_node_class_functions[] = { /* {{{ */ PHP_FALIAS(setUserData, dom_node_set_user_data, arginfo_dom_node_set_user_data) PHP_FALIAS(getUserData, dom_node_get_user_data, arginfo_dom_node_get_user_data) PHP_ME(domnode, getNodePath, arginfo_dom_node_getNodePath, ZEND_ACC_PUBLIC) + PHP_ME(domnode, getLineNo, arginfo_dom_node_getLineNo, ZEND_ACC_PUBLIC) PHP_ME(domnode, C14N, arginfo_dom_node_C14N, ZEND_ACC_PUBLIC) PHP_ME(domnode, C14NFile, arginfo_dom_node_C14NFile, ZEND_ACC_PUBLIC) {NULL, NULL, NULL} @@ -2029,6 +2033,24 @@ PHP_METHOD(domnode, getNodePath) } /* }}} */ +/* {{{ proto int DOMNode::getLineNo() + Gets line number for a node */ +PHP_METHOD(domnode, getLineNo) +{ + zval *id; + xmlNode *nodep; + dom_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern); + + RETURN_LONG(xmlGetLineNo(nodep)); +} +/* }}} */ + #endif /*