shepmaster / sxd-document

An XML library in Rust
MIT License
154 stars 36 forks source link

Feature request: functions for deleting elements and attributes #65

Closed jfeit closed 6 years ago

jfeit commented 6 years ago

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

shepmaster commented 6 years ago

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