update xmlNodeSetContent() and xmlNodeSetContentLen() to allow updating an
* tree.c: update xmlNodeSetContent() and xmlNodeSetContentLen()
to allow updating an attribute content
Daniel
diff --git a/tree.c b/tree.c
index 4ae0a1e..2b14558 100644
--- a/tree.c
+++ b/tree.c
@@ -3715,12 +3715,11 @@
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 @@
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 @@
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) {