mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-28 00:21:53 +03:00
update xmlNodeSetContent() and xmlNodeSetContentLen() to allow updating an
* tree.c: update xmlNodeSetContent() and xmlNodeSetContentLen() to allow updating an attribute content Daniel
This commit is contained in:
24
tree.c
24
tree.c
@ -3715,12 +3715,11 @@ xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) {
|
||||
switch (cur->type) {
|
||||
case XML_DOCUMENT_FRAG_NODE:
|
||||
case XML_ELEMENT_NODE:
|
||||
case XML_ATTRIBUTE_NODE:
|
||||
if (cur->children != NULL) xmlFreeNodeList(cur->children);
|
||||
cur->children = xmlStringGetNodeList(cur->doc, content);
|
||||
UPDATE_LAST_CHILD_AND_PARENT(cur)
|
||||
break;
|
||||
case XML_ATTRIBUTE_NODE:
|
||||
break;
|
||||
case XML_TEXT_NODE:
|
||||
case XML_CDATA_SECTION_NODE:
|
||||
case XML_ENTITY_REF_NODE:
|
||||
@ -3795,12 +3794,11 @@ xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
|
||||
switch (cur->type) {
|
||||
case XML_DOCUMENT_FRAG_NODE:
|
||||
case XML_ELEMENT_NODE:
|
||||
case XML_ATTRIBUTE_NODE:
|
||||
if (cur->children != NULL) xmlFreeNodeList(cur->children);
|
||||
cur->children = xmlStringLenGetNodeList(cur->doc, content, len);
|
||||
UPDATE_LAST_CHILD_AND_PARENT(cur)
|
||||
break;
|
||||
case XML_ATTRIBUTE_NODE:
|
||||
break;
|
||||
case XML_TEXT_NODE:
|
||||
case XML_CDATA_SECTION_NODE:
|
||||
case XML_ENTITY_REF_NODE:
|
||||
@ -5701,23 +5699,17 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
|
||||
return;
|
||||
}
|
||||
if (cur->type == XML_PI_NODE) {
|
||||
xmlBufferWriteChar(buf, "<?");
|
||||
xmlBufferWriteCHAR(buf, cur->name);
|
||||
if (cur->content != NULL) {
|
||||
xmlBufferWriteChar(buf, "<?");
|
||||
xmlBufferWriteCHAR(buf, cur->name);
|
||||
if (cur->content != NULL) {
|
||||
xmlBufferWriteChar(buf, " ");
|
||||
xmlBufferWriteChar(buf, " ");
|
||||
#ifndef XML_USE_BUFFER_CONTENT
|
||||
xmlBufferWriteCHAR(buf, cur->content);
|
||||
xmlBufferWriteCHAR(buf, cur->content);
|
||||
#else
|
||||
xmlBufferWriteCHAR(buf, xmlBufferContent(cur->content));
|
||||
xmlBufferWriteCHAR(buf, xmlBufferContent(cur->content));
|
||||
#endif
|
||||
}
|
||||
xmlBufferWriteChar(buf, "?>");
|
||||
} else {
|
||||
xmlBufferWriteChar(buf, "<?");
|
||||
xmlBufferWriteCHAR(buf, cur->name);
|
||||
xmlBufferWriteChar(buf, "?>");
|
||||
}
|
||||
xmlBufferWriteChar(buf, "?>");
|
||||
return;
|
||||
}
|
||||
if (cur->type == XML_COMMENT_NODE) {
|
||||
|
Reference in New Issue
Block a user