1--TEST-- 2Element::getAttributeNode() 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8echo "--- Get after parsing ---\n"; 9 10$dom = Dom\HTMLDocument::createFromString('<!DOCTYPE html><html><body align="foo" foo:bar="baz"></body></html>'); 11$body = $dom->getElementsByTagName("body")[0]; 12var_dump($body->getAttributeNode("align")->textContent); 13var_dump($body->getAttributeNode("foo:bar")->textContent); 14 15echo "--- Get after creating without namespace ---\n"; 16 17$body->setAttributeNode($attr = $dom->createAttribute("prefix:local")); 18$attr->value = "A"; 19var_dump($body->getAttributeNode("prefix:local")->textContent); 20 21echo "--- Get after creating with namespace ---\n"; 22 23$body->setAttributeNode($attr = $dom->createAttributeNS("urn:a", "prefix:local2")); 24$attr->value = "B"; 25var_dump($body->getAttributeNode("prefix:local2")->textContent); 26var_dump($body->getAttributeNode("Prefix:LOCAL2")->textContent); 27 28echo "--- Get after creating with namespace case sensitive ---\n"; 29 30$element = $dom->createElementNS("urn:a", "a:element"); 31$attr = $dom->createAttributeNS("urn:a", "Prefix:local2"); 32$element->setAttributeNode($attr); 33$attr->value = "C"; 34var_dump($element->getAttributeNode("Prefix:local2")->textContent); 35var_dump($element->getAttributeNode("Prefix:LOCAL2")); 36var_dump($element->getAttributeNode("prefix:local2")); 37 38?> 39--EXPECT-- 40--- Get after parsing --- 41string(3) "foo" 42string(3) "baz" 43--- Get after creating without namespace --- 44string(1) "A" 45--- Get after creating with namespace --- 46string(1) "B" 47string(1) "B" 48--- Get after creating with namespace case sensitive --- 49string(1) "C" 50NULL 51NULL 52