diff options
author | Kasimier T. Buchcik <kbuchcik@src.gnome.org> | 2006-02-15 10:57:50 +0000 |
---|---|---|
committer | Kasimier T. Buchcik <kbuchcik@src.gnome.org> | 2006-02-15 10:57:50 +0000 |
commit | eb46870850a8dec52a25ff63d406628cf31dcc9c (patch) | |
tree | 69fe14f5652658e1297920fb1614311d45734e0a | |
parent | a29aca1819ff59a7c6e57429e3c73cc825153d00 (diff) | |
download | libxml2-eb46870850a8dec52a25ff63d406628cf31dcc9c.tar.gz |
Fixed bug #328896 reported by Liron. The path for text- and
* tree.c: Fixed bug #328896 reported by Liron. The path
for text- and CDATA-section-nodes was computed incorrectly
in xmlGetNodePath().
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | tree.c | 25 |
2 files changed, 21 insertions, 10 deletions
@@ -1,3 +1,9 @@ +Wed Feb 15 11:55:22 CET 2006 Kasimier Buchcik <libxml2-cvs@cazic.net> + + * tree.c: Fixed bug #328896 reported by Liron. The path + for text- and CDATA-section-nodes was computed incorrectly + in xmlGetNodePath(). + Sun Feb 12 20:12:22 CET 2006 Daniel Veillard <daniel@veillard.com> * xmlregexp.c: bug fixes for #327167 as well as some cleanups @@ -4341,21 +4341,26 @@ xmlGetNodePath(xmlNodePtr node) */ tmp = cur->prev; while (tmp != NULL) { - if ((cur->type == XML_TEXT_NODE) || - (cur->type == XML_CDATA_SECTION_NODE)) + if ((tmp->type == XML_TEXT_NODE) || + (tmp->type == XML_CDATA_SECTION_NODE)) occur++; tmp = tmp->prev; } + /* + * Evaluate if this is the only text- or CDATA-section-node; + * if yes, then we'll get "text()", otherwise "text()[1]". + */ if (occur == 0) { tmp = cur->next; - while (tmp != NULL && occur == 0) { - if ((tmp->type == XML_TEXT_NODE) || - (tmp->type == XML_CDATA_SECTION_NODE)) - occur++; - tmp = tmp->next; - } - if (occur != 0) - occur = 1; + while (tmp != NULL) { + if ((tmp->type == XML_TEXT_NODE) || + (tmp->type == XML_CDATA_SECTION_NODE)) + { + occur = 1; + break; + } + tmp = tmp->next; + } } else occur++; } else if (cur->type == XML_PI_NODE) { |