1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-08-05 19:35:54 +03:00

trying to fix #104934 about some XHTML1 serialization issues. Daniel

* tree.c: trying to fix #104934 about some XHTML1 serialization
  issues.
Daniel
This commit is contained in:
Daniel Veillard
2003-02-10 16:12:39 +00:00
parent 809faa5237
commit fd7ce5f7e1
2 changed files with 22 additions and 4 deletions

View File

@@ -1,3 +1,8 @@
Mon Feb 10 17:11:22 CET 2003 Daniel Veillard <daniel@veillard.com>
* tree.c: trying to fix #104934 about some XHTML1 serialization
issues.
Mon Feb 10 16:41:13 CET 2003 Daniel Veillard <daniel@veillard.com> Mon Feb 10 16:41:13 CET 2003 Daniel Veillard <daniel@veillard.com>
* encoding.c xmlIO.c: fixing bug #104646 about iconv based * encoding.c xmlIO.c: fixing bug #104646 about iconv based

21
tree.c
View File

@@ -6670,7 +6670,7 @@ xmlNodeDumpOutputInternal(xmlOutputBufferPtr buf, xmlDocPtr doc,
return; return;
} }
if (cur->type == XML_NAMESPACE_DECL) { if (cur->type == XML_NAMESPACE_DECL) {
xmlNsDumpOutput(buf, cur); xmlNsDumpOutput(buf, (xmlNsPtr) cur);
return; return;
} }
@@ -6980,6 +6980,7 @@ xhtmlAttrListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
xmlAttrPtr lang = NULL; xmlAttrPtr lang = NULL;
xmlAttrPtr name = NULL; xmlAttrPtr name = NULL;
xmlAttrPtr id = NULL; xmlAttrPtr id = NULL;
xmlNodePtr parent;
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE #ifdef DEBUG_TREE
@@ -6988,6 +6989,7 @@ xhtmlAttrListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
#endif #endif
return; return;
} }
parent = cur->parent;
while (cur != NULL) { while (cur != NULL) {
if ((cur->ns == NULL) && (xmlStrEqual(cur->name, BAD_CAST "id"))) if ((cur->ns == NULL) && (xmlStrEqual(cur->name, BAD_CAST "id")))
id = cur; id = cur;
@@ -7019,9 +7021,20 @@ xhtmlAttrListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
* C.8 * C.8
*/ */
if ((name != NULL) && (id == NULL)) { if ((name != NULL) && (id == NULL)) {
xmlOutputBufferWriteString(buf, " id=\""); if ((parent != NULL) && (parent->name != NULL) &&
xmlAttrSerializeContent(buf->buffer, doc, name); ((xmlStrEqual(parent->name, BAD_CAST "a")) ||
xmlOutputBufferWriteString(buf, "\""); (xmlStrEqual(parent->name, BAD_CAST "p")) ||
(xmlStrEqual(parent->name, BAD_CAST "div")) ||
(xmlStrEqual(parent->name, BAD_CAST "img")) ||
(xmlStrEqual(parent->name, BAD_CAST "map")) ||
(xmlStrEqual(parent->name, BAD_CAST "applet")) ||
(xmlStrEqual(parent->name, BAD_CAST "form")) ||
(xmlStrEqual(parent->name, BAD_CAST "frame")) ||
(xmlStrEqual(parent->name, BAD_CAST "iframe")))) {
xmlOutputBufferWriteString(buf, " id=\"");
xmlAttrSerializeContent(buf->buffer, doc, name);
xmlOutputBufferWriteString(buf, "\"");
}
} }
/* /*
* C.7. * C.7.