public function __construct($node, $parent)
 {
     parent::__construct($node, $parent);
     self::$possible_attributes = array_merge(parent::$possible_attributes, self::$possible_attributes);
     self::$required_attributes = array_merge(parent::$required_attributes, self::$required_attributes);
     self::$possible_children = array_merge(parent::$possible_children, self::$possible_children);
     self::$required_children = array_merge(parent::$required_children, self::$required_children);
 }
 public function validate($map = null)
 {
     $result = parent::validate($map);
     if (json_decode($result)->result != 0 || $this->template == null) {
         return $result;
     }
     @($xml = file_get_contents($this->template));
     if (!$xml) {
         return $result;
     }
     $doc = new DOMDocument("1.0", "UTF-8");
     @$doc->loadXML($xml);
     $node = $doc->documentElement;
     $node = $this->node->ownerDocument->importNode($node, true);
     $this->parent->node->replaceChild($node, $this->node);
     $this->node = $node;
     return parent::validate($map);
 }