added support for custom elements and namespaces, fixes #31