Encode XML into stdclass