/** * @dataProvider dataProviderForTestGetAttribute * * @param string $xml * @param string|null $namespace * @param array $expectedAttributes * @return void */ public function testGetAttribute($xml, $namespace, $expectedAttributes) { $element = new SimpleXMLElement($xml); foreach ($expectedAttributes as $name => $expectedValue) { $value = $element->getAttribute($name, $namespace); $this->assertEquals($expectedValue, $value); } }
/** * If the text node has the attribute 'xml:space="preserve"', then preserve whitespace. * * @param \Box\Spout\Reader\Wrapper\SimpleXMLElement $textNode The text node element (<t>) whitespace may be preserved * @return bool Whether whitespace should be preserved */ protected function shouldPreserveWhitespace($textNode) { $spaceValue = $textNode->getAttribute('space', 'xml'); return $spaceValue === 'preserve'; }