/**
  * Feed the pci instance with data provided in the pci dom node
  * 
  * @param \oat\taoQtiItem\model\qti\ParserFactory $parser
  * @param DOMElement $data
  */
 public function feed(ParserFactory $parser, DOMElement $data)
 {
     $ns = $parser->getPciNamespace();
     $pciNodes = $parser->queryXPathChildren(array('portableCustomInteraction'), $data, $ns);
     if ($pciNodes->length) {
         $typeIdentifier = $pciNodes->item(0)->getAttribute('customInteractionTypeIdentifier');
         if (empty($typeIdentifier)) {
             throw new QtiModelException('the type identifier of the pci is missing');
         } else {
             $this->setTypeIdentifier($typeIdentifier);
         }
         $entryPoint = $pciNodes->item(0)->getAttribute('hook');
         if (empty($entryPoint)) {
             throw new QtiModelException('the entry point of the pci is missing');
         } else {
             $this->setEntryPoint($entryPoint);
         }
     }
     $libNodes = $parser->queryXPathChildren(array('portableCustomInteraction', 'resources', 'libraries', 'lib'), $data, $ns);
     $libs = array();
     foreach ($libNodes as $libNode) {
         $libs[] = $libNode->getAttribute('id');
     }
     $this->setLibraries($libs);
     $propertyNodes = $parser->queryXPathChildren(array('portableCustomInteraction', 'properties'), $data, $ns);
     if ($propertyNodes->length) {
         $properties = $this->extractPciProperties($propertyNodes->item(0), $ns);
         $this->setProperties($properties);
     }
     $markupNodes = $parser->queryXPathChildren(array('portableCustomInteraction', 'markup'), $data, $ns);
     if ($markupNodes->length) {
         $markup = $parser->getBodyData($markupNodes->item(0), true);
         $this->setMarkup($markup);
     }
 }
 /**
  * Feed the pci instance with data provided in the pci dom node
  *
  * @param ParserFactory $parser
  * @param DOMElement $data
  * @throws InvalidArgumentException
  * @throws QtiModelException
  */
 public function feed(ParserFactory $parser, DOMElement $data)
 {
     $ns = $parser->getPciNamespace();
     $pciNodes = $parser->queryXPathChildren(array('portableCustomInteraction'), $data, $ns);
     if (!$pciNodes->length) {
         throw new QtiModelException('no portableCustomInteraction node found');
     }
     $typeIdentifier = $pciNodes->item(0)->getAttribute('customInteractionTypeIdentifier');
     if (empty($typeIdentifier)) {
         throw new QtiModelException('the type identifier of the pci is missing');
     } else {
         $this->setTypeIdentifier($typeIdentifier);
     }
     $this->setEntryPoint($pciNodes->item(0)->getAttribute('hook'));
     $version = $pciNodes->item(0)->getAttribute('version');
     if ($version) {
         $this->setVersion($version);
     }
     $libNodes = $parser->queryXPathChildren(array('portableCustomInteraction', 'resources', 'libraries', 'lib'), $data, $ns);
     $libs = array();
     foreach ($libNodes as $libNode) {
         $libs[] = $libNode->getAttribute('id');
     }
     $this->setLibraries($libs);
     $stylesheetNodes = $parser->queryXPathChildren(array('portableCustomInteraction', 'resources', 'stylesheets', 'link'), $data, $ns);
     $stylesheets = array();
     foreach ($stylesheetNodes as $styleNode) {
         $stylesheets[] = $styleNode->getAttribute('href');
     }
     $this->setStylesheets($stylesheets);
     $mediaNodes = $parser->queryXPathChildren(array('portableCustomInteraction', 'resources', 'mediaFiles', 'file'), $data, $ns);
     $media = array();
     foreach ($mediaNodes as $mediaNode) {
         $media[] = $mediaNode->getAttribute('src');
     }
     $this->setMediaFiles($media);
     $propertyNodes = $parser->queryXPathChildren(array('portableCustomInteraction', 'properties'), $data, $ns);
     if ($propertyNodes->length) {
         $properties = $this->extractProperties($propertyNodes->item(0), $ns);
         $this->setProperties($properties);
     }
     $markupNodes = $parser->queryXPathChildren(array('portableCustomInteraction', 'markup'), $data, $ns);
     if ($markupNodes->length) {
         $markup = $parser->getBodyData($markupNodes->item(0), true, true);
         $this->setMarkup($markup);
     }
 }