]> granicus.if.org Git - php/commitdiff
- add xmlTextWriterStartComment and xmlTextWriterEndComment support
authorPierre Joye <pajoye@php.net>
Mon, 21 Feb 2005 15:05:54 +0000 (15:05 +0000)
committerPierre Joye <pajoye@php.net>
Mon, 21 Feb 2005 15:05:54 +0000 (15:05 +0000)
ext/xmlwriter/php_xmlwriter.c
ext/xmlwriter/php_xmlwriter.h

index 11e3a8e051a8fb11b571c3d3d4ef0030f6f7ab1a..8b685675db188e49266fe582e4af6c1d1e77b55b 100644 (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)
index c0b4ea5ba0ea418912142e9f2361a6ed1faf44df..5c5f263b180166ca1a228d31487d65398450aa80 100644 (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);