protected function parse($fileName)
 {
     $document = new DomDocument();
     $document->load($fileName);
     foreach ($document->getElementsByTagName('method') as $methodElement) {
         $this->parseMethodElement($methodElement);
     }
 }
示例#2
0
 public function testSeek()
 {
     $document = new DomDocument();
     $feed = $document->addElement('feed');
     $entry = $feed->addElement('entry');
     $entry = $feed->addElement('entry');
     $entry = $feed->addElement('entry')->addText('foo');
     $entry = $feed->addElement('entry');
     $entry = $feed->addElement('entry')->addText('bar');
     $iterator = new RecursiveDomIterator($document->documentElement);
     # $iterator = new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::SELF_FIRST);
     $iterator->seek(2);
     $this->assertEquals('foo', $iterator->current()->textContent);
     $iterator->seek(4);
     $this->assertEquals('bar', $iterator->current()->textContent);
 }
示例#3
0
 public function testAppendScalar()
 {
     $document = new DomDocument();
     $root = $document->addElement('root');
     $root->append('foobar');
     $this->assertXmlStringEqualsXmlFile(__DIR__ . '/DomDocument/foobar.xml', (string) $document);
 }
示例#4
0
 public function testAttributeToStringFromDocument()
 {
     $document = new DomDocument();
     $document->addElement('rss')->setAttribute('version', '2.0');
     $this->assertEquals('version: 2.0', (string) $document->documentElement->attributes->getNamedItem('version'));
 }
示例#5
0
文件: DomDocument.php 项目: blar/dom
 /**
  * @param string $baseClass Base class.
  * @param string $extendedClass Extended class.
  * @return self
  */
 public function registerNodeClass($baseClass, $extendedClass)
 {
     parent::registerNodeClass($baseClass, $extendedClass);
     return $this;
 }