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 272374 2008-12-31 11:17: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 : 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 :
71 :
72 : /* {{{ systemId string
73 : readonly=yes
74 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-D7C29F3E
75 : Since:
76 : */
77 : int dom_entity_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
78 0 : {
79 : xmlEntity *nodep;
80 :
81 0 : nodep = (xmlEntity *) dom_object_get_node(obj);
82 :
83 0 : if (nodep == NULL) {
84 0 : php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
85 0 : return FAILURE;
86 : }
87 :
88 0 : ALLOC_ZVAL(*retval);
89 0 : if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
90 0 : ZVAL_NULL(*retval);
91 : } else {
92 0 : ZVAL_STRING(*retval, (char *) (nodep->SystemID), 1);
93 : }
94 :
95 0 : return SUCCESS;
96 : }
97 :
98 : /* }}} */
99 :
100 :
101 :
102 : /* {{{ notationName string
103 : readonly=yes
104 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-6ABAEB38
105 : Since:
106 : */
107 : int dom_entity_notation_name_read(dom_object *obj, zval **retval TSRMLS_DC)
108 0 : {
109 : xmlEntity *nodep;
110 : char *content;
111 :
112 0 : nodep = (xmlEntity *) dom_object_get_node(obj);
113 :
114 0 : if (nodep == NULL) {
115 0 : php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
116 0 : return FAILURE;
117 : }
118 :
119 0 : ALLOC_ZVAL(*retval);
120 0 : if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
121 0 : ZVAL_NULL(*retval);
122 : } else {
123 0 : content = xmlNodeGetContent((xmlNodePtr) nodep);
124 0 : ZVAL_STRING(*retval, content, 1);
125 0 : xmlFree(content);
126 : }
127 :
128 0 : return SUCCESS;
129 : }
130 :
131 : /* }}} */
132 :
133 :
134 :
135 : /* {{{ actualEncoding string
136 : readonly=no
137 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-actualEncoding
138 : Since: DOM Level 3
139 : */
140 : int dom_entity_actual_encoding_read(dom_object *obj, zval **retval TSRMLS_DC)
141 0 : {
142 0 : ALLOC_ZVAL(*retval);
143 0 : ZVAL_NULL(*retval);
144 0 : return SUCCESS;
145 : }
146 :
147 : int dom_entity_actual_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
148 0 : {
149 0 : return SUCCESS;
150 : }
151 :
152 : /* }}} */
153 :
154 :
155 :
156 : /* {{{ encoding string
157 : readonly=no
158 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-encoding
159 : Since: DOM Level 3
160 : */
161 : int dom_entity_encoding_read(dom_object *obj, zval **retval TSRMLS_DC)
162 0 : {
163 0 : ALLOC_ZVAL(*retval);
164 0 : ZVAL_NULL(*retval);
165 0 : return SUCCESS;
166 : }
167 :
168 : int dom_entity_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
169 0 : {
170 0 : return SUCCESS;
171 : }
172 :
173 : /* }}} */
174 :
175 :
176 :
177 : /* {{{ version string
178 : readonly=no
179 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-version
180 : Since: DOM Level 3
181 : */
182 : int dom_entity_version_read(dom_object *obj, zval **retval TSRMLS_DC)
183 0 : {
184 0 : ALLOC_ZVAL(*retval);
185 0 : ZVAL_NULL(*retval);
186 0 : return SUCCESS;
187 : }
188 :
189 : int dom_entity_version_write(dom_object *obj, zval *newval TSRMLS_DC)
190 0 : {
191 0 : return SUCCESS;
192 : }
193 :
194 : /* }}} */
195 :
196 : #endif
|