1 : /*
2 : +----------------------------------------------------------------------+
3 : | PHP Version 5 |
4 : +----------------------------------------------------------------------+
5 : | Copyright (c) 1997-2009 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 : /* $Id: entity.c 272370 2008-12-31 11:15:49Z sebastian $ */
21 :
22 : #ifdef HAVE_CONFIG_H
23 : #include "config.h"
24 : #endif
25 :
26 : #include "php.h"
27 : #if HAVE_LIBXML && HAVE_DOM
28 : #include "php_dom.h"
29 :
30 :
31 : /*
32 : * class DOMEntity extends DOMNode
33 : *
34 : * URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-527DCFF2
35 : * Since:
36 : */
37 :
38 : const zend_function_entry php_dom_entity_class_functions[] = {
39 : {NULL, NULL, NULL}
40 : };
41 :
42 : /* {{{ publicId string
43 : readonly=yes
44 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-D7303025
45 : Since:
46 : */
47 : int dom_entity_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
48 0 : {
49 : xmlEntity *nodep;
50 :
51 0 : nodep = (xmlEntity *) dom_object_get_node(obj);
52 :
53 0 : if (nodep == NULL) {
54 0 : php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
55 0 : return FAILURE;
56 : }
57 :
58 0 : ALLOC_ZVAL(*retval);
59 0 : if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
60 0 : ZVAL_NULL(*retval);
61 : } else {
62 0 : ZVAL_STRING(*retval, (char *) (nodep->ExternalID), 1);
63 : }
64 :
65 0 : return SUCCESS;
66 : }
67 :
68 : /* }}} */
69 :
70 : /* {{{ systemId string
71 : readonly=yes
72 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-D7C29F3E
73 : Since:
74 : */
75 : int dom_entity_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
76 0 : {
77 : xmlEntity *nodep;
78 :
79 0 : nodep = (xmlEntity *) dom_object_get_node(obj);
80 :
81 0 : if (nodep == NULL) {
82 0 : php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
83 0 : return FAILURE;
84 : }
85 :
86 0 : ALLOC_ZVAL(*retval);
87 0 : if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
88 0 : ZVAL_NULL(*retval);
89 : } else {
90 0 : ZVAL_STRING(*retval, (char *) (nodep->SystemID), 1);
91 : }
92 :
93 0 : return SUCCESS;
94 : }
95 :
96 : /* }}} */
97 :
98 : /* {{{ notationName string
99 : readonly=yes
100 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-6ABAEB38
101 : Since:
102 : */
103 : int dom_entity_notation_name_read(dom_object *obj, zval **retval TSRMLS_DC)
104 0 : {
105 : xmlEntity *nodep;
106 : char *content;
107 :
108 0 : nodep = (xmlEntity *) dom_object_get_node(obj);
109 :
110 0 : if (nodep == NULL) {
111 0 : php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
112 0 : return FAILURE;
113 : }
114 :
115 0 : ALLOC_ZVAL(*retval);
116 0 : if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
117 0 : ZVAL_NULL(*retval);
118 : } else {
119 0 : content = xmlNodeGetContent((xmlNodePtr) nodep);
120 0 : ZVAL_STRING(*retval, content, 1);
121 0 : xmlFree(content);
122 : }
123 :
124 0 : return SUCCESS;
125 : }
126 :
127 : /* }}} */
128 :
129 : /* {{{ actualEncoding string
130 : readonly=no
131 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-actualEncoding
132 : Since: DOM Level 3
133 : */
134 : int dom_entity_actual_encoding_read(dom_object *obj, zval **retval TSRMLS_DC)
135 0 : {
136 0 : ALLOC_ZVAL(*retval);
137 0 : ZVAL_NULL(*retval);
138 0 : return SUCCESS;
139 : }
140 :
141 : int dom_entity_actual_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
142 0 : {
143 0 : return SUCCESS;
144 : }
145 :
146 : /* }}} */
147 :
148 : /* {{{ encoding string
149 : readonly=no
150 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-encoding
151 : Since: DOM Level 3
152 : */
153 : int dom_entity_encoding_read(dom_object *obj, zval **retval TSRMLS_DC)
154 0 : {
155 0 : ALLOC_ZVAL(*retval);
156 0 : ZVAL_NULL(*retval);
157 0 : return SUCCESS;
158 : }
159 :
160 : int dom_entity_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
161 0 : {
162 0 : return SUCCESS;
163 : }
164 :
165 : /* }}} */
166 :
167 : /* {{{ version string
168 : readonly=no
169 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-version
170 : Since: DOM Level 3
171 : */
172 : int dom_entity_version_read(dom_object *obj, zval **retval TSRMLS_DC)
173 0 : {
174 0 : ALLOC_ZVAL(*retval);
175 0 : ZVAL_NULL(*retval);
176 0 : return SUCCESS;
177 : }
178 :
179 : int dom_entity_version_write(dom_object *obj, zval *newval TSRMLS_DC)
180 0 : {
181 0 : return SUCCESS;
182 : }
183 :
184 : /* }}} */
185 :
186 : #endif
187 :
188 : /*
189 : * Local variables:
190 : * tab-width: 4
191 : * c-basic-offset: 4
192 : * End:
193 : * vim600: noet sw=4 ts=4 fdm=marker
194 : * vim<600: noet sw=4 ts=4
195 : */
|