From 042b1dae44e58fd59b01671d85129bc7971136bf Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 5 Nov 2013 15:31:32 +0100 Subject: Fix bug in fz_debug_xml. Print node and children, not node, children and siblings. --- source/fitz/xml.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'source/fitz/xml.c') diff --git a/source/fitz/xml.c b/source/fitz/xml.c index be233185..34a6b51e 100644 --- a/source/fitz/xml.c +++ b/source/fitz/xml.c @@ -28,26 +28,31 @@ static inline void indent(int n) void fz_debug_xml(fz_xml *item, int level) { - while (item) { - if (item->text) { - printf("%s\n", item->text); - } else { - struct attribute *att; + if (item->text) + { + printf("%s\n", item->text); + } + else + { + fz_xml *child; + struct attribute *att; + + indent(level); + printf("<%s", item->name); + for (att = item->atts; att; att = att->next) + printf(" %s=\"%s\"", att->name, att->value); + if (item->down) + { + printf(">\n"); + for (child = item->down; child; child = child->next) + fz_debug_xml(child, level + 1); indent(level); - printf("<%s", item->name); - for (att = item->atts; att; att = att->next) - printf(" %s=\"%s\"", att->name, att->value); - if (item->down) { - printf(">\n"); - fz_debug_xml(item->down, level + 1); - indent(level); - printf("\n", item->name); - } - else { - printf("/>\n"); - } + printf("\n", item->name); + } + else + { + printf("/>\n"); } - item = item->next; } } -- cgit v1.2.3