summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2005-02-21 15:05:54 (GMT)
committerPierre Joye <pajoye@php.net>2005-02-21 15:05:54 (GMT)
commit46eb3e977ced0a8f1bee816a237d5ce7c1938b43 (patch)
tree2af00ab699ddb0ce8289dc8af2277d2adb2c4a36 /ext
parentbafbe90392f95af4c6ad7175a6799238ff1cc870 (diff)
downloadphp-46eb3e977ced0a8f1bee816a237d5ce7c1938b43.tar.gz
- add xmlTextWriterStartComment and xmlTextWriterEndComment support
Diffstat (limited to 'ext')
-rw-r--r--ext/xmlwriter/php_xmlwriter.c59
-rw-r--r--ext/xmlwriter/php_xmlwriter.h3
2 files changed, 61 insertions, 1 deletions
diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c
index 11e3a8e..8b68567 100644
--- a/ext/xmlwriter/php_xmlwriter.c
+++ b/ext/xmlwriter/php_xmlwriter.c
@@ -37,9 +37,13 @@ static zend_function_entry xmlwriter_functions[] = {
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)
diff --git a/ext/xmlwriter/php_xmlwriter.h b/ext/xmlwriter/php_xmlwriter.h
index c0b4ea5..5c5f263 100644
--- a/ext/xmlwriter/php_xmlwriter.h
+++ b/ext/xmlwriter/php_xmlwriter.h
@@ -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);