Lines Matching refs:node

42 …atic zend_result dom_html5_serialize_comment(dom_html5_serialize_context *ctx, const xmlNode *node)  in dom_html5_serialize_comment()  argument
45 if (node->content) { in dom_html5_serialize_comment()
46 TRY(ctx->write_string(ctx->application_data, (const char*) node->content)); in dom_html5_serialize_comment()
51 …t dom_html5_serialize_processing_instruction(dom_html5_serialize_context *ctx, const xmlNode *node) in dom_html5_serialize_processing_instruction() argument
54 TRY(ctx->write_string(ctx->application_data, (const char *) node->name)); in dom_html5_serialize_processing_instruction()
56 if (node->content) { in dom_html5_serialize_processing_instruction()
57 TRY(ctx->write_string(ctx->application_data, (const char *) node->content)); in dom_html5_serialize_processing_instruction()
62 …c zend_result dom_html5_serialize_entity_ref(dom_html5_serialize_context *ctx, const xmlNode *node) in dom_html5_serialize_entity_ref() argument
65 TRY(ctx->write_string(ctx->application_data, (const char *) node->name)); in dom_html5_serialize_entity_ref()
134 …ic zend_result dom_html5_serialize_text_node(dom_html5_serialize_context *ctx, const xmlNode *node) in dom_html5_serialize_text_node() argument
136 if (!node->content) { in dom_html5_serialize_text_node()
140 const xmlNode *parent = node->parent; in dom_html5_serialize_text_node()
153 return ctx->write_string(ctx->application_data, (const char *) node->content); in dom_html5_serialize_text_node()
157 return dom_html5_escape_string(ctx, (const char *) node->content, false); in dom_html5_serialize_text_node()
160 …_result dom_html5_serialize_element_tag_name(dom_html5_serialize_context *ctx, const xmlNode *node) in dom_html5_serialize_element_tag_name() argument
163 if (node->ns != NULL && node->ns->prefix != NULL in dom_html5_serialize_element_tag_name()
164 …m_ns_is_fast(node, php_dom_ns_is_html_magic_token) || php_dom_ns_is_fast(node, php_dom_ns_is_mathm… in dom_html5_serialize_element_tag_name()
165 TRY(ctx->write_string(ctx->application_data, (const char *) node->ns->prefix)); in dom_html5_serialize_element_tag_name()
168 return ctx->write_string(ctx->application_data, (const char *) node->name); in dom_html5_serialize_element_tag_name()
171 …end_result dom_html5_serialize_element_start(dom_html5_serialize_context *ctx, const xmlNode *node) in dom_html5_serialize_element_start() argument
174 TRY(dom_html5_serialize_element_tag_name(ctx, node)); in dom_html5_serialize_element_start()
178 for (const xmlAttr *attr = node->properties; attr; attr = attr->next) { in dom_html5_serialize_element_start()
230 static bool dom_html5_serializes_as_void(const xmlNode *node) in dom_html5_serializes_as_void() argument
232 if (php_dom_ns_is_fast(node, php_dom_ns_is_html_magic_token)) { in dom_html5_serializes_as_void()
233 size_t name_length = strlen((const char *) node->name); in dom_html5_serializes_as_void()
235 dom_local_name_compare_ex(node, "area", strlen("area"), name_length) in dom_html5_serializes_as_void()
236 || dom_local_name_compare_ex(node, "base", strlen("base"), name_length) in dom_html5_serializes_as_void()
237 || dom_local_name_compare_ex(node, "br", strlen("br"), name_length) in dom_html5_serializes_as_void()
238 || dom_local_name_compare_ex(node, "col", strlen("col"), name_length) in dom_html5_serializes_as_void()
239 || dom_local_name_compare_ex(node, "embed", strlen("embed"), name_length) in dom_html5_serializes_as_void()
240 || dom_local_name_compare_ex(node, "hr", strlen("hr"), name_length) in dom_html5_serializes_as_void()
241 || dom_local_name_compare_ex(node, "img", strlen("img"), name_length) in dom_html5_serializes_as_void()
242 || dom_local_name_compare_ex(node, "input", strlen("input"), name_length) in dom_html5_serializes_as_void()
243 || dom_local_name_compare_ex(node, "link", strlen("link"), name_length) in dom_html5_serializes_as_void()
244 || dom_local_name_compare_ex(node, "meta", strlen("meta"), name_length) in dom_html5_serializes_as_void()
245 || dom_local_name_compare_ex(node, "source", strlen("source"), name_length) in dom_html5_serializes_as_void()
246 || dom_local_name_compare_ex(node, "track", strlen("track"), name_length) in dom_html5_serializes_as_void()
247 || dom_local_name_compare_ex(node, "wbr", strlen("wbr"), name_length) in dom_html5_serializes_as_void()
249 || dom_local_name_compare_ex(node, "basefont", strlen("basefont"), name_length) in dom_html5_serializes_as_void()
250 || dom_local_name_compare_ex(node, "bgsound", strlen("bgsound"), name_length) in dom_html5_serializes_as_void()
251 || dom_local_name_compare_ex(node, "frame", strlen("frame"), name_length) in dom_html5_serializes_as_void()
252 || dom_local_name_compare_ex(node, "keygen", strlen("keygen"), name_length) in dom_html5_serializes_as_void()
253 || dom_local_name_compare_ex(node, "param", strlen("param"), name_length)) { in dom_html5_serializes_as_void()
260 … zend_result dom_html5_serialize_element_end(dom_html5_serialize_context *ctx, const xmlNode *node) in dom_html5_serialize_element_end() argument
262 if (!dom_html5_serializes_as_void(node)) { in dom_html5_serialize_element_end()
264 TRY(dom_html5_serialize_element_tag_name(ctx, node)); in dom_html5_serialize_element_end()
271 static zend_result dom_html5_serialize_node(dom_html5_serialize_context *ctx, const xmlNode *node, … in dom_html5_serialize_node() argument
273 while (node != NULL) { in dom_html5_serialize_node()
274 switch (node->type) { in dom_html5_serialize_node()
276 TRY(dom_html5_serialize_doctype(ctx, (const xmlDtd *) node)); in dom_html5_serialize_node()
282 TRY(dom_html5_serialize_text_node(ctx, node)); in dom_html5_serialize_node()
287 TRY(dom_html5_serialize_processing_instruction(ctx, node)); in dom_html5_serialize_node()
292 TRY(dom_html5_serialize_comment(ctx, node)); in dom_html5_serialize_node()
297 TRY(dom_html5_serialize_element_start(ctx, node)); in dom_html5_serialize_node()
298 const xmlNode *children = node->children; in dom_html5_serialize_node()
299 …if (php_dom_ns_is_fast(node, php_dom_ns_is_html_magic_token) && xmlStrEqual(node->name, BAD_CAST "… in dom_html5_serialize_node()
300 children = php_dom_retrieve_templated_content(ctx->private_data, node); in dom_html5_serialize_node()
303 if (!dom_html5_serializes_as_void(node)) { in dom_html5_serialize_node()
304 node = children; in dom_html5_serialize_node()
309 TRY(dom_html5_serialize_element_end(ctx, node)); in dom_html5_serialize_node()
315 if (node->children) { in dom_html5_serialize_node()
316 node = node->children; in dom_html5_serialize_node()
324 TRY(dom_html5_serialize_entity_ref(ctx, node)); in dom_html5_serialize_node()
332 if (node->next) { in dom_html5_serialize_node()
333 node = node->next; in dom_html5_serialize_node()
337 node = node->parent; in dom_html5_serialize_node()
338 if (node == bound) { in dom_html5_serialize_node()
341 if (node->type == XML_ELEMENT_NODE) { in dom_html5_serialize_node()
342 TRY(dom_html5_serialize_element_end(ctx, node)); in dom_html5_serialize_node()
344 } while (node->next == NULL); in dom_html5_serialize_node()
345 node = node->next; in dom_html5_serialize_node()
353 zend_result dom_html5_serialize(dom_html5_serialize_context *ctx, const xmlNode *node) in dom_html5_serialize() argument
356 if (node->type != XML_ELEMENT_NODE in dom_html5_serialize()
357 && node->type != XML_DOCUMENT_FRAG_NODE in dom_html5_serialize()
358 && node->type != XML_DOCUMENT_NODE in dom_html5_serialize()
359 && node->type != XML_HTML_DOCUMENT_NODE) { in dom_html5_serialize()
362 if (node->type == XML_ELEMENT_NODE && dom_html5_serializes_as_void(node)) { in dom_html5_serialize()
369 xmlNodePtr children = php_dom_retrieve_templated_content(ctx->private_data, node); in dom_html5_serialize()
371 children = node->children; in dom_html5_serialize()
375 return dom_html5_serialize_node(ctx, children, node); in dom_html5_serialize()
379 zend_result dom_html5_serialize_outer(dom_html5_serialize_context *ctx, const xmlNode *node) in dom_html5_serialize_outer() argument
381 …if (node->type == XML_DOCUMENT_NODE || node->type == XML_HTML_DOCUMENT_NODE || node->type == XML_D… in dom_html5_serialize_outer()
382 node = node->children; in dom_html5_serialize_outer()
383 if (!node) { in dom_html5_serialize_outer()
386 return dom_html5_serialize_node(ctx, node, node->parent); in dom_html5_serialize_outer()
388 xmlNodePtr old_next = node->next; in dom_html5_serialize_outer()
389 ((xmlNodePtr) node)->next = NULL; in dom_html5_serialize_outer()
390 zend_result result = dom_html5_serialize_node(ctx, node, node->parent); in dom_html5_serialize_outer()
391 ((xmlNodePtr) node)->next = old_next; in dom_html5_serialize_outer()