????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 3.148.180.219 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/dom/tests/ |
Upload File : |
--TEST-- Elements: DOMElement functionality --SKIPIF-- <?php require_once('skipif.inc'); ?> --FILE-- <?php require_once("dom_test.inc"); $dom = new DOMDocument; $dom->loadXML($xmlstr); if(!$dom) { echo "Error while parsing the document\n"; exit; } $node = $dom->documentElement; echo "Tag Name: ".$node->tagName."\n"; $node->setAttribute('num', '1'); echo "Chapter: ".$node->getAttribute('num')."\n"; echo 'Attribute num exists?: '.($node->hasAttribute('num')?'Yes':'No')."\n"; $node->removeAttribute('num'); echo "Chapter: ".$node->getAttribute('num')."\n"; echo 'Attribute num exists?: '.($node->hasAttribute('num')?'Yes':'No')."\n"; echo "Language: ".$node->getAttribute('language')."\n"; $lang = $node->getAttributeNode('language'); $lang->nodeValue = 'en-US'; $node->setAttributeNode($lang); echo "Language: ".$node->getAttribute('language')."\n"; $node->removeAttributeNode($lang); echo "Language: ".$node->getAttribute('language')."\n"; echo "\n-- xml:lang --\n"; $node->setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:lang', 'en'); echo "Language: ".$node->getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang')."\n"; echo 'Attribute xml:lang exists?: '.($node->hasAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang')?'Yes':'No')."\n"; $node->removeAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang'); echo "Language: ".$node->getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang')."\n"; echo 'Attribute xml:lang exists?: '.($node->hasAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang')?'Yes':'No')."\n"; $lang = $dom->createAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:lang'); $lang->nodeValue = 'en-GB'; $node->setAttributeNodeNS($lang); unset($lang); echo "Language: ".$node->getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang')."\n"; $lang = $node->getAttributeNodeNS('http://www.w3.org/XML/1998/namespace', 'lang'); echo "Language: ".$lang->value."\n"; echo "\n-- Elements --\n"; $rows = $node->getElementsByTagName('row'); echo "Row Count: ".$rows->length."\n"; $element_ns = new DOMElement('newns:myelement', 'default content', 'urn::dummyns'); $node->appendChild($element_ns); $element_ns = new DOMElement('newns2:myelement', 'second default content', 'urn::dummyns'); $node->appendChild($element_ns); $myelements = $node->getElementsByTagNameNS('urn::dummyns', 'myelement'); $mylen = $myelements->length; echo "myelements Count: ".$mylen."\n"; echo "\n-- IDs --\n"; $node->setAttribute('idatt', 'n1'); $node->setIdAttribute('idatt', TRUE); for ($x = 0; $x < $mylen; $x++) { $current = $myelements->item($x); $current->setAttributeNS('urn::dummyns', 'newns:idatt', 'n'.($x+2))."\n"; $current->setIdAttributeNS('urn::dummyns', 'idatt', TRUE); } echo 'Element Name: '.(($elem = $dom->getElementByID('n1'))?$elem->localName:'Not Found')."\n"; $idatt = $node->getAttributeNode('idatt'); $node->setIdAttributeNode($idatt, FALSE); echo 'Element Name: '.(($elem = $dom->getElementByID('n1'))?$elem->localName:'Not Found')."\n"; echo 'Element Name: '.(($elem = $dom->getElementByID('n3'))?$elem->nodeName:'Not Found')."\n"; for ($x = 0; $x < $mylen; $x++) { $node = $myelements->item($x); $node->setIdAttributeNS('urn::dummyns', 'idatt', FALSE); } echo 'Element Name: '.(($elem = $dom->getElementByID('n3'))?$elem->nodeName:'Not Found')."\n"; ?> --EXPECT-- Tag Name: chapter Chapter: 1 Attribute num exists?: Yes Chapter: Attribute num exists?: No Language: en Language: en-US Language: -- xml:lang -- Language: en Attribute xml:lang exists?: Yes Language: Attribute xml:lang exists?: No Language: en-GB Language: en-GB -- Elements -- Row Count: 3 myelements Count: 2 -- IDs -- Element Name: chapter Element Name: Not Found Element Name: newns2:myelement Element Name: Not Found