How could I add a parent to a node? #628
-
Original xml
The xml output I want
I can append as a child under measure by append_child, but how could I make every elements under measure as the child of ? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
append_child + append_move for all other children of Note that you will need to be careful about iterating, as append_move changes the sibling structure; you could do something like
|
Beta Was this translation helpful? Give feedback.
-
Fix the bug, just change
to
|
Beta Was this translation helpful? Give feedback.
append_child + append_move for all other children of
measure
; see https://pugixml.org/docs/manual.html#modify.moveNote that you will need to be careful about iterating, as append_move changes the sibling structure; you could do something like