protected function parse($fileName) { $document = new DomDocument(); $document->load($fileName); foreach ($document->getElementsByTagName('method') as $methodElement) { $this->parseMethodElement($methodElement); } }
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); }
public function testAppendScalar() { $document = new DomDocument(); $root = $document->addElement('root'); $root->append('foobar'); $this->assertXmlStringEqualsXmlFile(__DIR__ . '/DomDocument/foobar.xml', (string) $document); }
public function testAttributeToStringFromDocument() { $document = new DomDocument(); $document->addElement('rss')->setAttribute('version', '2.0'); $this->assertEquals('version: 2.0', (string) $document->documentElement->attributes->getNamedItem('version')); }
/** * @param string $baseClass Base class. * @param string $extendedClass Extended class. * @return self */ public function registerNodeClass($baseClass, $extendedClass) { parent::registerNodeClass($baseClass, $extendedClass); return $this; }