summaryrefslogtreecommitdiff
path: root/source/fitz/xml.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2013-11-05 15:31:32 +0100
committerTor Andersson <tor.andersson@artifex.com>2013-11-05 16:05:12 +0100
commit042b1dae44e58fd59b01671d85129bc7971136bf (patch)
tree7ff1a1b4152d5d860a79001e879d56aeb7b386aa /source/fitz/xml.c
parent1f930f64d8c5abf89b62b806efca1c64b216e413 (diff)
downloadmupdf-042b1dae44e58fd59b01671d85129bc7971136bf.tar.xz
Fix bug in fz_debug_xml.
Print node and children, not node, children and siblings.
Diffstat (limited to 'source/fitz/xml.c')
-rw-r--r--source/fitz/xml.c41
1 files changed, 23 insertions, 18 deletions
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("</%s>\n", item->name);
- }
- else {
- printf("/>\n");
- }
+ printf("</%s>\n", item->name);
+ }
+ else
+ {
+ printf("/>\n");
}
- item = item->next;
}
}