public static function fromXml($version, $xml, $options = array())
{
$doc = new \DOMDocument();
if (!$xml) {
return static::errorInit($version, array('Missing Resource Body'));
}
libxml_use_internal_errors(true);
if (!$doc->loadXML($xml)) {
$errors = array();
foreach (libxml_get_errors() as $err) {
$errors[] = $err->message;
}
$obj = static::errorInit($version, $errors);
libxml_clear_errors();
return $obj;
}
static::remapValues($doc, XpathRemap::model()->findAllByXpath('/' . static::$resource_type));
$obj = static::fromXmlDom($version, $doc->documentElement, $options);
$obj->addAuditData('input', \CHtml::encode($xml));
return $obj;
}