protected function xmlToObj($xml)
    {
        $xmlobj = simplexml_load_string($xml);
        
        if (!$xmlobj instanceof \SimpleXMLElement) {
            $badXmlLog = '/tmp/bad.xml';
            $this->error = "Unable to parse output XML, which has been logged in $badXmlLog. Possible problems: CCSID, encoding, binary data in an alpha field (use binary/BYTE type instead); if < or > are the problem, consider using CDATA tags.";
            error_log($xml, 3, $badXmlLog);
            return false;
        } 
        
        return $xmlobj;
    }