| 5286 | } |
| 5287 | |
| 5288 | PUGI__FN xml_parse_result xml_node::append_buffer(const void* contents, size_t size, unsigned int options, xml_encoding encoding) |
| 5289 | { |
| 5290 | // append_buffer is only valid for elements/documents |
| 5291 | if (!impl::allow_insert_child(type(), node_element)) return impl::make_parse_result(status_append_invalid_root); |
| 5292 | |
| 5293 | // get document node |
| 5294 | impl::xml_document_struct* doc = &impl::get_document(_root); |
| 5295 | |
| 5296 | // disable document_buffer_order optimization since in a document with multiple buffers comparing buffer pointers does not make sense |
| 5297 | doc->header |= impl::xml_memory_page_contents_shared_mask; |
| 5298 | |
| 5299 | // get extra buffer element (we'll store the document fragment buffer there so that we can deallocate it later) |
| 5300 | impl::xml_memory_page* page = 0; |
| 5301 | impl::xml_extra_buffer* extra = static_cast<impl::xml_extra_buffer*>(doc->allocate_memory(sizeof(impl::xml_extra_buffer), page)); |
| 5302 | (void)page; |
| 5303 | |
| 5304 | if (!extra) return impl::make_parse_result(status_out_of_memory); |
| 5305 | |
| 5306 | // save name; name of the root has to be NULL before parsing - otherwise closing node mismatches will not be detected at the top level |
| 5307 | char_t* rootname = _root->name; |
| 5308 | _root->name = 0; |
| 5309 | |
| 5310 | // parse |
| 5311 | char_t* buffer = 0; |
| 5312 | xml_parse_result res = impl::load_buffer_impl(doc, _root, const_cast<void*>(contents), size, options, encoding, false, false, &buffer); |
| 5313 | |
| 5314 | // restore name |
| 5315 | _root->name = rootname; |
| 5316 | |
| 5317 | // add extra buffer to the list |
| 5318 | extra->buffer = buffer; |
| 5319 | extra->next = doc->extra_buffers; |
| 5320 | doc->extra_buffers = extra; |
| 5321 | |
| 5322 | return res; |
| 5323 | } |
| 5324 | |
| 5325 | PUGI__FN xml_node xml_node::find_child_by_attribute(const char_t* name_, const char_t* attr_name, const char_t* attr_value) const |
| 5326 | { |
nothing calls this directly
no test coverage detected