xref: /PHP-7.3/ext/dom/notation.c (revision 8d3f8ca1)
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 * class DOMNotation extends DOMNode
30 *
31 * URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-5431D1B9
32 * Since:
33 */
34 
35 const zend_function_entry php_dom_notation_class_functions[] = {
36 	PHP_FE_END
37 };
38 
39 /* {{{ attribute protos, not implemented yet */
40 
41 /* {{{ publicId	string
42 readonly=yes
43 URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-54F2B4D0
44 Since:
45 */
dom_notation_public_id_read(dom_object * obj,zval * retval)46 int dom_notation_public_id_read(dom_object *obj, zval *retval)
47 {
48 	xmlEntityPtr nodep = (xmlEntityPtr) dom_object_get_node(obj);
49 
50 	if (nodep == NULL) {
51 		php_dom_throw_error(INVALID_STATE_ERR, 0);
52 		return FAILURE;
53 	}
54 
55 	if (nodep->ExternalID) {
56 		ZVAL_STRING(retval, (char *) (nodep->ExternalID));
57 	} else {
58 		ZVAL_EMPTY_STRING(retval);
59 	}
60 
61 	return SUCCESS;
62 }
63 
64 /* }}} */
65 
66 /* {{{ systemId	string
67 readonly=yes
68 URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-E8AAB1D0
69 Since:
70 */
dom_notation_system_id_read(dom_object * obj,zval * retval)71 int dom_notation_system_id_read(dom_object *obj, zval *retval)
72 {
73 	xmlEntityPtr nodep = (xmlEntityPtr) dom_object_get_node(obj);
74 
75 	if (nodep == NULL) {
76 		php_dom_throw_error(INVALID_STATE_ERR, 0);
77 		return FAILURE;
78 	}
79 
80 	if (nodep->SystemID) {
81 		ZVAL_STRING(retval, (char *) (nodep->SystemID));
82 	} else {
83 		ZVAL_EMPTY_STRING(retval);
84 	}
85 
86 	return SUCCESS;
87 }
88 
89 /* }}} */
90 
91 /* }}} */
92 
93 #endif
94 
95 /*
96  * Local variables:
97  * tab-width: 4
98  * c-basic-offset: 4
99  * End:
100  * vim600: noet sw=4 ts=4 fdm=marker
101  * vim<600: noet sw=4 ts=4
102  */
103