Beispiel #1
0
 protected function nodeToInstance(dom\node $node)
 {
     if ($node instanceof dom\handler) {
         $sNamespace = $node->getRoot()->getNamespace();
     } else {
         if ($node instanceof dom\element) {
             $sNamespace = $node->getNamespace();
         } else {
             $this->throwException(sprintf('Cannot convert %s to instance', $node->asToken()));
         }
     }
     if ($sNamespace == $this->getNamespace()) {
         $result = $node;
     } else {
         $result = $this->createTemplate($node);
     }
     return $result;
 }
Beispiel #2
0
 public function loadDomElement(dom\node $node)
 {
     if ($node instanceof dom\document) {
         $result = $node->getRoot();
     } else {
         $result = $node;
     }
     if (!$result) {
         $this->throwException('No result node');
     }
     return $result;
 }