php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
documenttype.c
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Copyright (c) The PHP Group |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.01 of the PHP license, |
6 | that is bundled with this package in the file LICENSE, and is |
7 | available through the world-wide-web at the following url: |
8 | https://www.php.net/license/3_01.txt |
9 | If you did not receive a copy of the PHP license and are unable to |
10 | obtain it through the world-wide-web, please send a note to |
11 | license@php.net so we can mail you a copy immediately. |
12 +----------------------------------------------------------------------+
13 | Authors: Christian Stocker <chregu@php.net> |
14 | Rob Richards <rrichards@php.net> |
15 +----------------------------------------------------------------------+
16*/
17
18#ifdef HAVE_CONFIG_H
19#include <config.h>
20#endif
21
22#include "php.h"
23#if defined(HAVE_LIBXML) && defined(HAVE_DOM)
24#include "php_dom.h"
25#include "dom_properties.h"
26
27/* {{{ name string
28readonly=yes
29URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1844763134
30Since:
31*/
33{
34 DOM_PROP_NODE(xmlDtdPtr, dtdptr, obj);
35 ZVAL_STRING(retval, dtdptr->name ? (char *) (dtdptr->name) : "");
36 return SUCCESS;
37}
38
39/* }}} */
40
41/* {{{ entities DOMNamedNodeMap
42readonly=yes
43URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1788794630
44Since:
45*/
47{
48 DOM_PROP_NODE(xmlDtdPtr, dtdptr, obj);
49
50 php_dom_create_iterator(retval, DOM_DTD_NAMEDNODEMAP, php_dom_follow_spec_intern(obj));
51
52 xmlHashTable *entityht = (xmlHashTable *) dtdptr->entities;
53
54 dom_object *intern = Z_DOMOBJ_P(retval);
55 dom_namednode_iter(obj, XML_ENTITY_NODE, intern, entityht, NULL, 0, NULL, 0);
56
57 return SUCCESS;
58}
59
60/* }}} */
61
62/* {{{ notations DOMNamedNodeMap
63readonly=yes
64URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D46829EF
65Since:
66*/
68{
69 DOM_PROP_NODE(xmlDtdPtr, dtdptr, obj);
70
71 php_dom_create_iterator(retval, DOM_DTD_NAMEDNODEMAP, php_dom_follow_spec_intern(obj));
72
73 xmlHashTable *notationht = (xmlHashTable *) dtdptr->notations;
74
75 dom_object *intern = Z_DOMOBJ_P(retval);
76 dom_namednode_iter(obj, XML_NOTATION_NODE, intern, notationht, NULL, 0, NULL, 0);
77
78 return SUCCESS;
79}
80
81/* }}} */
82
83/* {{{ publicId string
84readonly=yes
85URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-Core-DocType-publicId
86Since: DOM Level 2
87*/
89{
90 DOM_PROP_NODE(xmlDtdPtr, dtdptr, obj);
91
92 if (dtdptr->ExternalID) {
93 ZVAL_STRING(retval, (char *) (dtdptr->ExternalID));
94 } else {
96 }
97
98 return SUCCESS;
99}
100
101/* }}} */
102
103/* {{{ systemId string
104readonly=yes
105URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-Core-DocType-systemId
106Since: DOM Level 2
107*/
109{
110 DOM_PROP_NODE(xmlDtdPtr, dtdptr, obj);
111
112 if (dtdptr->SystemID) {
113 ZVAL_STRING(retval, (char *) (dtdptr->SystemID));
114 } else {
116 }
117
118 return SUCCESS;
119}
120
121/* }}} */
122
123/* {{{ internalSubset string
124readonly=yes
125URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-Core-DocType-internalSubset
126Since: DOM Level 2
127*/
129{
130 DOM_PROP_NODE(xmlDtdPtr, dtdptr, obj);
131
132 xmlDtdPtr intsubset;
133 if (dtdptr->doc != NULL && ((intsubset = xmlGetIntSubset(dtdptr->doc)) != NULL)) {
134 smart_str ret_buf = {0};
135 xmlNodePtr cur = intsubset->children;
136
137 while (cur != NULL) {
138 xmlOutputBuffer *buff = xmlAllocOutputBuffer(NULL);
139
140 if (buff != NULL) {
141 xmlNodeDumpOutput (buff, NULL, cur, 0, 0, NULL);
142 xmlOutputBufferFlush(buff);
143
144 smart_str_appendl(&ret_buf, (const char *) xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff));
145
146 (void)xmlOutputBufferClose(buff);
147 }
148
149 cur = cur->next;
150 }
151
152 if (ret_buf.s) {
153 ZVAL_NEW_STR(retval, smart_str_extract(&ret_buf));
154 return SUCCESS;
155 }
156 }
157
159
160 return SUCCESS;
161}
162
163/* }}} */
164
165#endif
zend_result dom_documenttype_entities_read(dom_object *obj, zval *retval)
zend_result dom_documenttype_internal_subset_read(dom_object *obj, zval *retval)
zend_result dom_documenttype_name_read(dom_object *obj, zval *retval)
zend_result dom_documenttype_notations_read(dom_object *obj, zval *retval)
zend_result dom_documenttype_public_id_read(dom_object *obj, zval *retval)
zend_result dom_documenttype_system_id_read(dom_object *obj, zval *retval)
#define DOM_PROP_NODE(type, name, obj)
#define NULL
Definition gdcache.h:45
#define SUCCESS
Definition hash_sha3.c:261
void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, const char *local, size_t local_len, const char *ns, size_t ns_len)
void php_dom_create_iterator(zval *return_value, dom_iterator_type iterator_type, bool modern)
@ DOM_DTD_NAMEDNODEMAP
Definition php_dom.h:117
const XML_ENTITY_NODE
const XML_NOTATION_NODE
zend_string * s
struct _dom_object dom_object
#define Z_DOMOBJ_P(zv)
Definition xml_common.h:36
#define ZVAL_STRING(z, s)
Definition zend_API.h:956
#define ZVAL_EMPTY_STRING(z)
Definition zend_API.h:961
struct _zval_struct zval
ZEND_API void(ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data)
#define ZVAL_NULL(z)
#define ZVAL_NEW_STR(z, s)
ZEND_RESULT_CODE zend_result
Definition zend_types.h:64
zval retval