Cleanup before PECL publishing

- added optional arguments: badname_element, key_attr,
notices_on_import_error
- removed redundant code
- more warning and notices in case of errors
Add "dom" extension dependency in tests