summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2004-05-17 03:17:26 +0000
committerDaniel Veillard <veillard@src.gnome.org>2004-05-17 03:17:26 +0000
commit62040be3602d66ce983dcb22017af4ccc5d8276d (patch)
treeced47dffff815197904959bf5110782d0ec5afee
parenta98357ad4a6afad3cfae8bda08e3cadaf5d05b15 (diff)
downloadlibxml2-62040be3602d66ce983dcb22017af4ccc5d8276d.tar.gz
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
-rw-r--r--ChangeLog9
-rw-r--r--entities.c2
-rw-r--r--tree.c8
-rw-r--r--xmlwriter.c4
4 files changed, 19 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index fbb9e2fe..f331410a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/entities.c b/entities.c
index db1c4c9c..5b6f931e 100644
--- a/entities.c
+++ b/entities.c
@@ -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++ = '#';
diff --git a/tree.c b/tree.c
index 08ac7317..4d18cffd 100644
--- a/tree.c
+++ b/tree.c
@@ -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);
}
}
diff --git a/xmlwriter.c b/xmlwriter.c
index fc2b0669..e7d4cc8a 100644
--- a/xmlwriter.c
+++ b/xmlwriter.c
@@ -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: