コード例 #1
0
ファイル: sxe.c プロジェクト: austintgriffith/php7
/* {{{ proto void SimpleXMLIterator::next()
 Move to next element */
PHP_METHOD(ce_SimpleXMLIterator, next)
{
	php_sxe_iterator iter;

	iter.sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
	ce_SimpleXMLElement->iterator_funcs.funcs->move_forward((zend_object_iterator*)&iter TSRMLS_CC);
}
コード例 #2
0
ファイル: sxe.c プロジェクト: austintgriffith/php7
/* {{{ proto SimpleXMLIterator SimpleXMLIterator::getChildren()
 Get child element iterator */ 
PHP_METHOD(ce_SimpleXMLIterator, getChildren)
{
	php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);

	if (!sxe->iter.data || sxe->iter.type == SXE_ITER_ATTRLIST) {
		return; /* return NULL */
	}
	RETURN_ZVAL(sxe->iter.data, 1, 0);
}
コード例 #3
0
ファイル: sxe.c プロジェクト: austintgriffith/php7
/* {{{ proto SimpleXMLIterator SimpleXMLIterator::current()
 Get current element */
PHP_METHOD(ce_SimpleXMLIterator, current)
{
	php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);

	if (!sxe->iter.data) {
		return; /* return NULL */
	}

	RETURN_ZVAL(sxe->iter.data, 1, 0);
}
コード例 #4
0
ファイル: sxe.c プロジェクト: Doap/php-src
/* {{{ proto bool SimpleXMLIterator::valid()
 Check whether iteration is valid */
PHP_METHOD(ce_SimpleXMLIterator, valid)
{
	php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
	
	if (zend_parse_parameters_none() == FAILURE) {
		return;
	}

	RETURN_BOOL(sxe->iter.data);
}
コード例 #5
0
ファイル: sxe.c プロジェクト: austintgriffith/php7
/* {{{ proto bool SimpleXMLIterator::hasChildren()
 Check whether element has children (elements) */ 
PHP_METHOD(ce_SimpleXMLIterator, hasChildren)
{
	php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
	php_sxe_object *child;
	xmlNodePtr      node;

	if (!sxe->iter.data || sxe->iter.type == SXE_ITER_ATTRLIST) {
		RETURN_FALSE;
	}
	child = php_sxe_fetch_object(sxe->iter.data TSRMLS_CC);

	GET_NODE(child, node);
	if (node) {
		node = node->children;
	}
	while (node && node->type != XML_ELEMENT_NODE) {
		node = node->next;
	}
	RETURN_BOOL(node ? 1 : 0);
}
コード例 #6
0
ファイル: sxe.c プロジェクト: Doap/php-src
/* {{{ proto void SimpleXMLIterator::rewind()
 Rewind to first element */
PHP_METHOD(ce_SimpleXMLIterator, rewind)
{
	php_sxe_iterator iter;
	
	if (zend_parse_parameters_none() == FAILURE) {
		return;
	}

	iter.sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
	ce_SimpleXMLElement->iterator_funcs.funcs->rewind((zend_object_iterator*)&iter TSRMLS_CC);
}
コード例 #7
0
ファイル: sxe.c プロジェクト: Doap/php-src
/* {{{ proto SimpleXMLIterator SimpleXMLIterator::current()
 Get current element */
PHP_METHOD(ce_SimpleXMLIterator, current)
{
	php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
	
	if (zend_parse_parameters_none() == FAILURE) {
		return;
	}

	if (!sxe->iter.data) {
		return; /* return NULL */
	}

	RETURN_ZVAL(sxe->iter.data, 1, 0);
}
コード例 #8
0
ファイル: sxe.c プロジェクト: austintgriffith/php7
/* {{{ proto string SimpleXMLIterator::key()
 Get name of current child element */
PHP_METHOD(ce_SimpleXMLIterator, key)
{
	xmlNodePtr curnode;
	php_sxe_object *intern;
	php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);

	if (!sxe->iter.data) {
		RETURN_FALSE;
	}

	intern = (php_sxe_object *)zend_object_store_get_object(sxe->iter.data TSRMLS_CC);
	if (intern != NULL && intern->node != NULL) {
		curnode = (xmlNodePtr)((php_libxml_node_ptr *)intern->node)->node;
		RETURN_STRINGL((char*)curnode->name, xmlStrlen(curnode->name), 1);
	}
    
	RETURN_FALSE;
}
コード例 #9
0
ファイル: sxe.c プロジェクト: austintgriffith/php7
/* {{{ proto bool SimpleXMLIterator::valid()
 Check whether iteration is valid */
PHP_METHOD(ce_SimpleXMLIterator, valid)
{
	php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);

	RETURN_BOOL(sxe->iter.data);
}