Finite element approximation of the fields of bulk and interfacial line defects