Refactoring: handle wlxmlDocument events in a separate module