1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

- add xmlTextWriterStartComment and xmlTextWriterEndComment support

This commit is contained in:
Pierre Joye
2005-02-21 15:05:54 +00:00
parent bafbe90392
commit 46eb3e977c
2 changed files with 61 additions and 1 deletions

View File

@@ -36,10 +36,14 @@ static zend_function_entry xmlwriter_functions[] = {
#if LIBXML_VERSION >= 20605
PHP_FE(xmlwriter_set_indent, NULL)
PHP_FE(xmlwriter_set_indent_string, NULL)
#endif
#if LIBXML_VERSION >= 20616
PHP_FE(xmlwriter_start_comment, NULL)
PHP_FE(xmlwriter_end_comment, NULL)
#endif
PHP_FE(xmlwriter_start_attribute, NULL)
PHP_FE(xmlwriter_end_attribute, NULL)
PHP_FE(xmlwriter_start_attribute_ns, NULL)
PHP_FE(xmlwriter_end_attribute, NULL)
PHP_FE(xmlwriter_write_attribute, NULL)
PHP_FE(xmlwriter_write_attribute_ns, NULL)
PHP_FE(xmlwriter_start_element, NULL)
@@ -742,6 +746,59 @@ PHP_FUNCTION(xmlwriter_text)
RETURN_FALSE;
}
/* {{{ proto bool xmlwriter_start_comment(resource xmlwriter)
Create start comment - returns FALSE on error */
PHP_FUNCTION(xmlwriter_start_comment)
{
zval *pind;
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
int retval;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pind) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
ptr = intern->ptr;
if (ptr) {
retval = xmlTextWriterStartComment(ptr);
if (retval != -1) {
RETURN_TRUE;
}
}
RETURN_FALSE;
}
/* {{{ proto bool xmlwriter_end_comment(resource xmlwriter)
Create end comment - returns FALSE on error */
PHP_FUNCTION(xmlwriter_end_comment)
{
zval *pind;
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
int retval;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pind) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
ptr = intern->ptr;
if (ptr) {
retval = xmlTextWriterEndComment(ptr);
if (retval != -1) {
RETURN_TRUE;
}
}
RETURN_FALSE;
}
/* {{{ proto bool xmlwriter_write_comment(resource xmlwriter, string content)
Write full comment tag - returns FALSE on error */
PHP_FUNCTION(xmlwriter_write_comment)

View File

@@ -67,6 +67,9 @@ PHP_FUNCTION(xmlwriter_text);
PHP_FUNCTION(xmlwriter_start_document);
PHP_FUNCTION(xmlwriter_end_document);
PHP_FUNCTION(xmlwriter_write_comment);
PHP_FUNCTION(xmlwriter_start_comment);
PHP_FUNCTION(xmlwriter_end_comment);
PHP_FUNCTION(xmlwriter_start_dtd);
PHP_FUNCTION(xmlwriter_end_dtd);
PHP_FUNCTION(xmlwriter_write_dtd);