public static function fromXML(SimpleXMLElement $xml) { $th = new TargetHost(); $th->setAuthentication(Authentication::fromXML($xml->authentication)); $th->setUrl((string) $xml->url); $th->setSite((string) $xml->site); if ($xml->forwardProxy) { $th->setProxy(ForwardProxy::fromXML($xml->forwardProxy)); } if ($xml->connectionParameters) { $th->setConnectionParameters(ConnectionParameters::fromXML($xml->connectionParameters)); } return $th; }