Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/pugixml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6811,17 +6811,28 @@ namespace pugi
cur = cur->first_child;
}
else if (cur->next_sibling)
{
cur = cur->next_sibling;
walker.out(arg_for_each);
}
else
{
while (!cur->next_sibling && cur != _root && cur->parent)
{
xml_node arg_out(cur);

--walker._depth;
cur = cur->parent;

walker.out(arg_out);
}

if (cur != _root)
{
xml_node arg_out(cur);
cur = cur->next_sibling;
walker.out(arg_out);
}
}
}
while (cur && cur != _root);
Expand Down
2 changes: 2 additions & 0 deletions src/pugixml.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,8 @@ namespace pugi

// Callback that is called for each node traversed
virtual bool for_each(xml_node& node) = 0;
// Callback that is called after each node traversed
virtual void out(const xml_node& ){}

// Callback that is called when traversal ends
virtual bool end(xml_node& node);
Expand Down