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