Malformed XML check

Added check for malformed manifest. Even a random document as input would cause a segmentation fault in the manifest parsing function.