Пример #1
0
 /**
  * @test
  * @expectedException RuntimeException
  */
 public function tryingToGetTheOpeningTagForAClosingTagThrowsAnException()
 {
     $this->reader->xml('<root><b></b></root>');
     while ($this->reader->read()) {
         if ('root' == $this->reader->localName || XMLReader::END_ELEMENT != $this->reader->nodeType) {
             continue;
         }
         $this->reader->nodeOpenString();
     }
 }
Пример #2
0
 /**
  * Reads the input XML stream and calls appropriate methods when
  * encountering opening (or empty) tags, closing tags or text
  * content. When completed, save() is called.
  */
 public function process()
 {
     $this->preProcessAction();
     while ($this->r->read()) {
         switch ($this->r->nodeType) {
             case XMLReader::ELEMENT:
                 $this->nodeOpen();
                 break;
             case XMLReader::END_ELEMENT:
                 $this->nodeClose();
                 break;
             case XMLReader::TEXT:
             case XMLReader::SIGNIFICANT_WHITESPACE:
                 $this->nodeContent();
         }
     }
     $this->r->close();
     $this->save();
 }