Description
There are a number of shortcomings in the XML DOM interface:
-
Something annoying is that every method to navigate the DOM tree return a nilable:
#first_element_child
,#next
,#parent
, ... This is in stark contrast with the rest of the stdlib API, where methods expect the value to exist and raise otherwise, with a question mark alternative method to return a nilable, for example#parent
vs#parent?
.That would be a breaking change, but it would make the API easier and in par with the rest of the stdlib.
-
There are no means to mutate the DOM, apart for the isolated
#unlink
... that follows the libxml naming instead of the DOM spec by-the-way (it should be named#remove
). We should be able to create, if not whole documents, at least nodes and fragments, and to append and insert nodes wherever.