Back to index

php5  5.3.10
cdatasection.c
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2012 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Authors: Christian Stocker <chregu@php.net>                          |
00016    |          Rob Richards <rrichards@php.net>                            |
00017    +----------------------------------------------------------------------+
00018 */
00019 
00020 /* $Id: cdatasection.c 321634 2012-01-01 13:15:04Z felipe $ */
00021 
00022 #ifdef HAVE_CONFIG_H
00023 #include "config.h"
00024 #endif
00025 
00026 #include "php.h"
00027 #if HAVE_LIBXML && HAVE_DOM
00028 #include "php_dom.h"
00029 
00030 
00031 /* {{{ arginfo */
00032 ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_cdatasection_construct, 0, 0, 1)
00033        ZEND_ARG_INFO(0, value)
00034 ZEND_END_ARG_INFO();
00035 /* }}} */
00036 
00037 /*
00038 * class DOMCdataSection extends DOMText 
00039 *
00040 * URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-667469212
00041 * Since: 
00042 */
00043 
00044 const zend_function_entry php_dom_cdatasection_class_functions[] = {
00045        PHP_ME(domcdatasection, __construct, arginfo_dom_cdatasection_construct, ZEND_ACC_PUBLIC)
00046        PHP_FE_END
00047 };
00048 
00049 /* {{{ proto void DOMCdataSection::__construct(string value); */
00050 PHP_METHOD(domcdatasection, __construct)
00051 {
00052 
00053        zval *id;
00054        xmlNodePtr nodep = NULL, oldnode = NULL;
00055        dom_object *intern;
00056        char *value = NULL;
00057        int value_len;
00058        zend_error_handling error_handling;
00059 
00060        zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
00061        if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_cdatasection_class_entry, &value, &value_len) == FAILURE) {
00062               zend_restore_error_handling(&error_handling TSRMLS_CC);
00063               return;
00064        }
00065 
00066        zend_restore_error_handling(&error_handling TSRMLS_CC);
00067        nodep = xmlNewCDataBlock(NULL, (xmlChar *) value, value_len);
00068 
00069        if (!nodep) {
00070               php_dom_throw_error(INVALID_STATE_ERR, 1 TSRMLS_CC);
00071               RETURN_FALSE;
00072        }
00073 
00074        intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC);
00075        if (intern != NULL) {
00076               oldnode = dom_object_get_node(intern);
00077               if (oldnode != NULL) {
00078                      php_libxml_node_free_resource(oldnode  TSRMLS_CC);
00079               }
00080               php_libxml_increment_node_ptr((php_libxml_node_object *)intern, nodep, (void *)intern TSRMLS_CC);
00081        }
00082 }
00083 /* }}} end DOMCdataSection::__construct */
00084 
00085 #endif
00086 
00087 /*
00088  * Local variables:
00089  * tab-width: 4
00090  * c-basic-offset: 4
00091  * End:
00092  * vim600: noet sw=4 ts=4 fdm=marker
00093  * vim<600: noet sw=4 ts=4
00094  */