Fix xml processing

Some fixes until official updates are released.

Backport to stable5 and stable6 requested.

\cc @karlitschek @PVince81