  We consider motion of a "magnetic'' soliton in two-component condensates
along a non-uniform and time-dependent backgrounds in framework of the
Hamiltonian mechanics. Our approach is based on generalization of Stokes'
remark that soliton's velocity is related with its inverse half-width by the
dispersion law for linear waves continued to the region of complex wave
numbers. We obtain expressions for the canonical momentum and the Hamiltonian
as functions of soliton's velocity and transform the Hamilton equations to the
Newton-like equation. The theory is illustrated by several examples of concrete
soliton's dynamics.
