public function __construct(\DOMElement $xml = null)
{
if ($xml === null) {
return;
}
if (!$xml->hasAttribute('contactType')) {
throw new \Exception('Missing contactType on ContactPerson.');
}
$this->contactType = $xml->getAttribute('contactType');
$this->Extensions = Extensions::getList($xml);
$this->Company = self::getStringElement($xml, 'Company');
$this->GivenName = self::getStringElement($xml, 'GivenName');
$this->SurName = self::getStringElement($xml, 'SurName');
$this->EmailAddress = self::getStringElements($xml, 'EmailAddress');
$this->TelephoneNumber = self::getStringElements($xml, 'TelephoneNumber');
foreach ($xml->attributes as $attr) {
if ($attr->nodeName == "contactType") {
continue;
}
$this->ContactPersonAttributes[$attr->nodeName] = $attr->nodeValue;
}
}