Changed ip/dn switch from regex to simplexml