add test to bug #173
fixes #173
fixes #158
invalid xml characters test
Merge pull request #174 from baev/model-refactoring

some bug fixes