예제 #1
0
파일: Element.php 프로젝트: ziyou-liu/1line
 protected function prepareInsert($item)
 {
     if (empty($item)) {
         return;
     }
     if (is_string($item)) {
         $item = Entities::replaceAllEntities($item);
         $frag = $this->ownerDocument->createDocumentFragment();
         try {
             $frag->appendXML($item);
         } catch (Exception $e) {
         }
         return $frag;
     }
     if ($item instanceof \DOMNode) {
         if ($item->ownerDocument !== $this->ownerDocument) {
             return $this->ownerDocument->importNode($item, true);
         }
         return $item;
     }
 }