MFH: Add method DomNode::getLineNo to return line number for a parsed node

This commit is contained in:
Rob Richards 2009-01-13 18:06:48 +00:00
parent 6757c0c9fc
commit 5336054811
2 changed files with 23 additions and 0 deletions

View File

@ -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);

View File

@ -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}
@ -1950,6 +1954,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
/*