|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-04-27 21:16 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 12:00:01 2025 UTC |
Description: ------------ When executing $node->get_elements_by_tagname("text"); it is not only the tag named "text" that is returned, but all tags named "#text". This is wrong. I am searching for all "text" nodes that are to be found in the input xml file, not those who are named #text and are domtext elements. Why do domtext element have a name and why are they returned? The documentation for states "Every element of the array is an DomElement.". Not true as DomText are returned too. Here is the input file "get_elements_by_tagname.xml" used for the test: <section> <text> <lang code="default">Hardware clock set to UTC</lang> <lang code="fr">Horloge BIOS est UTC</lang> </text> <widget type="checkbox"> <default>off</default> </widget> </section> Reproduce code: --------------- <?php $filename="get_elements_by_tagname.xml"; if(!$dom = domxml_open_file($filename)) { print "Could not open $filename"; return; } $root=$dom->document_element(); $textnodes=$root->get_elements_by_tagname("text"); print "<pre>\n"; print_r($textnodes); print "</pre>\n"; ?>