public function DOMTreeBuilderTest::testXmlNamespaces in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php \Masterminds\HTML5\Tests\Parser\DOMTreeBuilderTest::testXmlNamespaces()
File
- vendor/
masterminds/ html5/ test/ HTML5/ Parser/ DOMTreeBuilderTest.php, line 180 - Test the Tree Builder.
Class
- DOMTreeBuilderTest
- These tests are functional, not necessarily unit tests.
Namespace
Masterminds\HTML5\Tests\ParserCode
public function testXmlNamespaces() {
$dom = $this
->parse('<!DOCTYPE html><html>
<t:body xmlns:t="http://www.example.com">
<a t:href="bar">foo</a>
</body>
<div>foo</div>
</html>', array(
'xmlNamespaces' => true,
));
$a = $dom
->getElementsByTagName('a')
->item(0);
$attr = $a
->getAttributeNode('t:href');
$this
->assertEquals('http://www.example.com', $attr->namespaceURI);
$list = $dom
->getElementsByTagNameNS('http://www.example.com', 'body');
$this
->assertEquals(1, $list->length);
}