コード例 #1
0
ファイル: XPath.php プロジェクト: highestgoodlikewater/spizer
 /**
  * Handle incoming documents
  * 
  * @param Spizer_Document_Xml $document 
  * @see   Spizer_Handler_Abstract::handle()
  */
 public function handle(Spizer_Document $document)
 {
     // Silently ignore non-XML documents
     if (!$document instanceof Spizer_Document_Xml) {
         return;
     }
     $query = $this->_config['query'];
     $tags = $document->getXpath()->query($query);
     if ($tags instanceof DOMNodeList) {
         foreach ($tags as $tag) {
             $data = array('query' => $query);
             if (isset($this->_config['message'])) {
                 $data['message'] = $this->_config['message'];
             }
             if (isset($this->_config['captureValue'])) {
                 $value = $document->getXpath()->evaluate($this->_config['captureValue'], $tag);
                 if ($value) {
                     $data['captureValue'] = (string) $value;
                 }
             }
             $this->_log($data);
         }
     }
 }
コード例 #2
0
 /**
  * Handle incoming documents
  * 
  * @param Spizer_Document_Xml $document 
  * @see   Spizer_Handler_Abstract::handle()
  */
 public function handle(Spizer_Document $document)
 {
     // Silently ignore non-XML documents
     if (!$document instanceof Spizer_Document_Xml) {
         return;
     }
     $query = $this->_config['query'];
     $tags = $document->getXpath()->query($query);
     if ($tags->length == 0) {
         $data = array('query' => $query);
         if (isset($this->_config['message'])) {
             $data['message'] = $this->_config['message'];
         }
         $this->_log($data);
     }
 }