shepmaster / sxd-document

An XML library in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: functions for deleting elements and attributes

jfeit opened this issue · comments

commented

When using sxd-document for manipulating XML document I am missing functions for
deleting/removing elements and attributes.

Is there any direct way to achieve this?
(I am a Rust beginner, so far I have used Perl and XML:Twig).

It seems one can remove an element by appending it to other element, which is not attached to the main tree:

let waste = document.create_element("waste");

and later:

waste.append_child(element_to_delete.unwrap());

but it seems rather obscure (and will not work for attributes).

With regards
Josef

Yep, that's pretty embarrassing! I've got some local code for this that I hope to push up soon!