xref: /PHP-5.3/ext/dom/notation.c (revision a2045ff3)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 5                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1997-2013 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 TSRMLS_DC)48 int dom_notation_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
49 {
50 	xmlEntityPtr nodep;
51 
52 	nodep = (xmlEntityPtr) dom_object_get_node(obj);
53 
54 	if (nodep == NULL) {
55 		php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
56 		return FAILURE;
57 	}
58 
59 	ALLOC_ZVAL(*retval);
60 	if (nodep->ExternalID) {
61 		ZVAL_STRING(*retval, (char *) (nodep->ExternalID), 1);
62 	} else {
63 		ZVAL_EMPTY_STRING(*retval);
64 	}
65 
66 	return SUCCESS;
67 }
68 
69 /* }}} */
70 
71 /* {{{ systemId	string
72 readonly=yes
73 URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-E8AAB1D0
74 Since:
75 */
dom_notation_system_id_read(dom_object * obj,zval ** retval TSRMLS_DC)76 int dom_notation_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
77 {
78 	xmlEntityPtr nodep;
79 
80 	nodep = (xmlEntityPtr) dom_object_get_node(obj);
81 
82 	if (nodep == NULL) {
83 		php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
84 		return FAILURE;
85 	}
86 
87 	ALLOC_ZVAL(*retval);
88 	if (nodep->SystemID) {
89 		ZVAL_STRING(*retval, (char *) (nodep->SystemID), 1);
90 	} else {
91 		ZVAL_EMPTY_STRING(*retval);
92 	}
93 
94 	return SUCCESS;
95 }
96 
97 /* }}} */
98 
99 /* }}} */
100 
101 #endif
102 
103 /*
104  * Local variables:
105  * tab-width: 4
106  * c-basic-offset: 4
107  * End:
108  * vim600: noet sw=4 ts=4 fdm=marker
109  * vim<600: noet sw=4 ts=4
110  */
111