Back to index

php5  5.3.10
entity.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: entity.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 /*
00032 * class DOMEntity extends DOMNode 
00033 *
00034 * URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-527DCFF2
00035 * Since: 
00036 */
00037 
00038 const zend_function_entry php_dom_entity_class_functions[] = {
00039        PHP_FE_END
00040 };
00041 
00042 /* {{{ publicId      string 
00043 readonly=yes 
00044 URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-D7303025
00045 Since: 
00046 */
00047 int dom_entity_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
00048 {
00049        xmlEntity *nodep;
00050 
00051        nodep = (xmlEntity *) dom_object_get_node(obj);
00052 
00053        if (nodep == NULL) {
00054               php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
00055               return FAILURE;
00056        }
00057 
00058        ALLOC_ZVAL(*retval);
00059        if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
00060               ZVAL_NULL(*retval);
00061        } else {
00062               ZVAL_STRING(*retval, (char *) (nodep->ExternalID), 1);
00063        }
00064 
00065        return SUCCESS;
00066 }
00067 
00068 /* }}} */
00069 
00070 /* {{{ systemId      string 
00071 readonly=yes 
00072 URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-D7C29F3E
00073 Since: 
00074 */
00075 int dom_entity_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
00076 {
00077        xmlEntity *nodep;
00078 
00079        nodep = (xmlEntity *) dom_object_get_node(obj);
00080 
00081        if (nodep == NULL) {
00082               php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
00083               return FAILURE;
00084        }
00085 
00086        ALLOC_ZVAL(*retval);
00087        if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
00088               ZVAL_NULL(*retval);
00089        } else {
00090               ZVAL_STRING(*retval, (char *) (nodep->SystemID), 1);
00091        }
00092 
00093        return SUCCESS;
00094 }
00095 
00096 /* }}} */
00097 
00098 /* {{{ notationName  string 
00099 readonly=yes 
00100 URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-6ABAEB38
00101 Since: 
00102 */
00103 int dom_entity_notation_name_read(dom_object *obj, zval **retval TSRMLS_DC)
00104 {
00105        xmlEntity *nodep;
00106        char *content;
00107 
00108        nodep = (xmlEntity *) dom_object_get_node(obj);
00109 
00110        if (nodep == NULL) {
00111               php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
00112               return FAILURE;
00113        }
00114 
00115        ALLOC_ZVAL(*retval);
00116        if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
00117               ZVAL_NULL(*retval);
00118        } else {
00119               content = xmlNodeGetContent((xmlNodePtr) nodep);
00120               ZVAL_STRING(*retval, content, 1);
00121               xmlFree(content);
00122        }
00123 
00124        return SUCCESS;
00125 }
00126 
00127 /* }}} */
00128 
00129 /* {{{ actualEncoding       string 
00130 readonly=no 
00131 URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-actualEncoding
00132 Since: DOM Level 3
00133 */
00134 int dom_entity_actual_encoding_read(dom_object *obj, zval **retval TSRMLS_DC)
00135 {
00136        ALLOC_ZVAL(*retval);
00137        ZVAL_NULL(*retval);
00138        return SUCCESS;
00139 }
00140 
00141 int dom_entity_actual_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
00142 {
00143        return SUCCESS;
00144 }
00145 
00146 /* }}} */
00147 
00148 /* {{{ encoding      string 
00149 readonly=no 
00150 URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-encoding
00151 Since: DOM Level 3
00152 */
00153 int dom_entity_encoding_read(dom_object *obj, zval **retval TSRMLS_DC)
00154 {
00155        ALLOC_ZVAL(*retval);
00156        ZVAL_NULL(*retval);
00157        return SUCCESS;
00158 }
00159 
00160 int dom_entity_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
00161 {
00162        return SUCCESS;
00163 }
00164 
00165 /* }}} */
00166 
00167 /* {{{ version       string 
00168 readonly=no 
00169 URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-version
00170 Since: DOM Level 3
00171 */
00172 int dom_entity_version_read(dom_object *obj, zval **retval TSRMLS_DC)
00173 {
00174        ALLOC_ZVAL(*retval);
00175        ZVAL_NULL(*retval);
00176        return SUCCESS;
00177 }
00178 
00179 int dom_entity_version_write(dom_object *obj, zval *newval TSRMLS_DC)
00180 {
00181        return SUCCESS;
00182 }
00183 
00184 /* }}} */
00185 
00186 #endif
00187 
00188 /*
00189  * Local variables:
00190  * tab-width: 4
00191  * c-basic-offset: 4
00192  * End:
00193  * vim600: noet sw=4 ts=4 fdm=marker
00194  * vim<600: noet sw=4 ts=4
00195  */