1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-25 23:21:26 +03:00

avoid returning default namespace when searching from an attribute reverse

* tree.c: avoid returning default namespace when searching
  from an attribute
* entities.c xmlwriter.c: reverse xmlEncodeSpecialChars() behaviour
  back to escaping " since the normal serialization routines do not
  use it anymore, should close bug #134477 . Tried to make
  the writer avoid it too but it didn't work.
Daniel
This commit is contained in:
Daniel Veillard 2004-05-17 03:17:26 +00:00
parent a98357ad4a
commit 62040be360
4 changed files with 19 additions and 4 deletions

View File

@ -1,3 +1,12 @@
Sun May 16 23:12:35 CEST 2004 Daniel Veillard <daniel@veillard.com>
* tree.c: avoid returning default namespace when searching
from an attribute
* entities.c xmlwriter.c: reverse xmlEncodeSpecialChars() behaviour
back to escaping " since the normal serialization routines do not
use it anymore, should close bug #134477 . Tried to make
the writer avoid it too but it didn't work.
Sun May 16 01:07:16 CEST 2004 Daniel Veillard <daniel@veillard.com>
* doc/ChangeLog.awk doc/ChangeLog.xsl: fixed escaping

View File

@ -625,7 +625,6 @@ xmlEncodeSpecialChars(xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar *input) {
*out++ = 'm';
*out++ = 'p';
*out++ = ';';
#if 0
} else if (*cur == '"') {
*out++ = '&';
*out++ = 'q';
@ -633,7 +632,6 @@ xmlEncodeSpecialChars(xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar *input) {
*out++ = 'o';
*out++ = 't';
*out++ = ';';
#endif
} else if (*cur == '\r') {
*out++ = '&';
*out++ = '#';

8
tree.c
View File

@ -5481,6 +5481,7 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar * href)
{
xmlNsPtr cur;
xmlNodePtr orig = node;
int is_attr;
if ((node == NULL) || (href == NULL))
return (NULL);
@ -5524,6 +5525,7 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar * href)
}
return (doc->oldNs);
}
is_attr = (node->type == XML_ATTRIBUTE_NODE);
while (node != NULL) {
if ((node->type == XML_ENTITY_REF_NODE) ||
(node->type == XML_ENTITY_NODE) ||
@ -5534,7 +5536,8 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar * href)
while (cur != NULL) {
if ((cur->href != NULL) && (href != NULL) &&
(xmlStrEqual(cur->href, href))) {
if (xmlNsInScope(doc, orig, node, cur->href) == 1)
if (((!is_attr) || (cur->prefix != NULL)) &&
(xmlNsInScope(doc, orig, node, cur->href) == 1))
return (cur);
}
cur = cur->next;
@ -5544,7 +5547,8 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar * href)
if (cur != NULL) {
if ((cur->href != NULL) && (href != NULL) &&
(xmlStrEqual(cur->href, href))) {
if (xmlNsInScope(doc, orig, node, cur->href) == 1)
if (((!is_attr) || (cur->prefix != NULL)) &&
(xmlNsInScope(doc, orig, node, cur->href) == 1))
return (cur);
}
}

View File

@ -1326,6 +1326,10 @@ xmlTextWriterWriteString(xmlTextWriterPtr writer, const xmlChar * content)
switch (p->state) {
case XML_TEXTWRITER_NAME:
case XML_TEXTWRITER_TEXT:
#if 0
buf = NULL;
xmlOutputBufferWriteEscape(writer->out, content, NULL);
#endif
buf = xmlEncodeSpecialChars(NULL, content);
break;
case XML_TEXTWRITER_ATTRIBUTE: