in reply to OO style question: how much information to hide?
And more unit tests, fewer bugs.
I favor the explicit style. set_attr() and del_attr() should only work on start tags. To allow otherwise is to risk hiding problems.