Replace homegrown xml parser with builtin PHP functionality
Fix strange problem where filesize would return a wrong value on some systems,
leading to an incomplete xml string
Try to ensure we actually have a unique title
Remove unused parameter
Add workaround for differences between mg1 and mgd2
isset() returns true for empty guids in mgd2, so we use empty() instead,
which will also catch empty guids on metadata objects