Shouldn't the "if (parser)" in this line be kept as it may also be needed for the xerces terminate ??