plugin -  check for well-formed xhtml/xml

give user a chance to abort changes made by plugin if xhtml/xml to be
added/modified is not well formed
prevent plugin closing last tab and cleanups

prevent plugin closing last tab and cleanups