1 /*
2 +----------------------------------------------------------------------+
3 | PHP Version 7 |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 1997-2018 The PHP Group |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
15 | Authors: Christian Stocker <chregu@php.net> |
16 | Rob Richards <rrichards@php.net> |
17 +----------------------------------------------------------------------+
18 */
19
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
23
24 #include "php.h"
25 #if HAVE_LIBXML && HAVE_DOM
26 #include "php_dom.h"
27
28
29 /*
30 * class DOMEntity extends DOMNode
31 *
32 * URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-527DCFF2
33 * Since:
34 */
35
36 const zend_function_entry php_dom_entity_class_functions[] = {
37 PHP_FE_END
38 };
39
40 /* {{{ publicId string
41 readonly=yes
42 URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-D7303025
43 Since:
44 */
dom_entity_public_id_read(dom_object * obj,zval * retval)45 int dom_entity_public_id_read(dom_object *obj, zval *retval)
46 {
47 xmlEntity *nodep = (xmlEntity *) dom_object_get_node(obj);
48
49 if (nodep == NULL) {
50 php_dom_throw_error(INVALID_STATE_ERR, 0);
51 return FAILURE;
52 }
53
54 if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
55 ZVAL_NULL(retval);
56 } else {
57 ZVAL_STRING(retval, (char *) (nodep->ExternalID));
58 }
59
60 return SUCCESS;
61 }
62
63 /* }}} */
64
65 /* {{{ systemId string
66 readonly=yes
67 URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-D7C29F3E
68 Since:
69 */
dom_entity_system_id_read(dom_object * obj,zval * retval)70 int dom_entity_system_id_read(dom_object *obj, zval *retval)
71 {
72 xmlEntity *nodep = (xmlEntity *) dom_object_get_node(obj);
73
74 if (nodep == NULL) {
75 php_dom_throw_error(INVALID_STATE_ERR, 0);
76 return FAILURE;
77 }
78
79 if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
80 ZVAL_NULL(retval);
81 } else {
82 ZVAL_STRING(retval, (char *) (nodep->SystemID));
83 }
84
85 return SUCCESS;
86 }
87
88 /* }}} */
89
90 /* {{{ notationName string
91 readonly=yes
92 URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-6ABAEB38
93 Since:
94 */
dom_entity_notation_name_read(dom_object * obj,zval * retval)95 int dom_entity_notation_name_read(dom_object *obj, zval *retval)
96 {
97 xmlEntity *nodep = (xmlEntity *) dom_object_get_node(obj);
98 char *content;
99
100 if (nodep == NULL) {
101 php_dom_throw_error(INVALID_STATE_ERR, 0);
102 return FAILURE;
103 }
104
105 if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
106 ZVAL_NULL(retval);
107 } else {
108 content = (char *) xmlNodeGetContent((xmlNodePtr) nodep);
109 ZVAL_STRING(retval, content);
110 xmlFree(content);
111 }
112
113 return SUCCESS;
114 }
115
116 /* }}} */
117
118 /* {{{ actualEncoding string
119 readonly=no
120 URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-actualEncoding
121 Since: DOM Level 3
122 */
dom_entity_actual_encoding_read(dom_object * obj,zval * retval)123 int dom_entity_actual_encoding_read(dom_object *obj, zval *retval)
124 {
125 ZVAL_NULL(retval);
126 return SUCCESS;
127 }
128
dom_entity_actual_encoding_write(dom_object * obj,zval * newval)129 int dom_entity_actual_encoding_write(dom_object *obj, zval *newval)
130 {
131 return SUCCESS;
132 }
133
134 /* }}} */
135
136 /* {{{ encoding string
137 readonly=no
138 URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-encoding
139 Since: DOM Level 3
140 */
dom_entity_encoding_read(dom_object * obj,zval * retval)141 int dom_entity_encoding_read(dom_object *obj, zval *retval)
142 {
143 ZVAL_NULL(retval);
144 return SUCCESS;
145 }
146
dom_entity_encoding_write(dom_object * obj,zval * newval)147 int dom_entity_encoding_write(dom_object *obj, zval *newval)
148 {
149 return SUCCESS;
150 }
151
152 /* }}} */
153
154 /* {{{ version string
155 readonly=no
156 URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-version
157 Since: DOM Level 3
158 */
dom_entity_version_read(dom_object * obj,zval * retval)159 int dom_entity_version_read(dom_object *obj, zval *retval)
160 {
161 ZVAL_NULL(retval);
162 return SUCCESS;
163 }
164
dom_entity_version_write(dom_object * obj,zval * newval)165 int dom_entity_version_write(dom_object *obj, zval *newval)
166 {
167 return SUCCESS;
168 }
169
170 /* }}} */
171
172 #endif
173
174 /*
175 * Local variables:
176 * tab-width: 4
177 * c-basic-offset: 4
178 * End:
179 * vim600: noet sw=4 ts=4 fdm=marker
180 * vim<600: noet sw=4 ts=4
181 */
182