Bug #15257 Updated: Can't retrieve node content

From: Date: Tue, 29 Jan 2002 09:30:35 +0000
Subject: Bug #15257 Updated: Can't retrieve node content
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-78431@lists.php.net to get a copy of this message
ID: 15257 Updated by: chregu Old Summary: Can't retrieve node content Reported By: work@gullidge.com Old Status: Open Status: Closed Bug Type: DOM XML related Operating System: Windows2000 PHP Version: 4.1.1 New Comment: this will be implemented in the next version of php (4.2) or already in cvs now with $node->get_content() Previous Comments: ------------------------------------------------------------------------ [2002-01-29 03:38:36] work@gullidge.com Thank you sir, That works a treat. ------------------------------------------------------------------------ [2002-01-28 14:31:50] jtate@mi-corporation.NOSPAM.com Try replacing your $nodes[$nodeNumber]->content line with $redirectURL = getContent($nodes[$nodeNumber]); Where getContent is: function getContent ($n) { if (!($children = $n->children())) return ''; $content = ''; foreach ($children as $c) { if ($c->type == XML_TEXT_NODE) { $content .= $c->content; } } return $content; } I can verify the behavior. I'm thinking it is a bug too. If functionality has been changed, a change in documentation is in order. ------------------------------------------------------------------------ [2002-01-28 14:13:23] work@gullidge.com Sorry in advance if this isn't considered a bug. The DomXML content property is no longer available in 4.1.1 as we now are referencing elements instead of nodes, but I can't see a way of extracting the content of the element/node. Following works in 4.06: $docnode = xmldoc($xmlString); $rootNode = $docnode->root(); $nodes = $rootNode->children(); for ($nodeNumber = 0; $nodeNumber < count($nodes); $nodeNumber++) { $nodeName = $nodes[$nodeNumber]->name; // ... some more nodeName comparisons here if ($nodeName == "redirect") { $redirectURL = $nodes[$nodeNumber]->content; } } In 4.1.1 tagname replaces name, but I can't see anything that replaces or gives me a reference to content. Again, sorry if this isn't considered a bug. I've only been coding PHP for 2 days and I'm still finding my way around. PS. I could do with using 4.1.1 as 4.0.6 doesn't allow https in curl ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=15257&edit=1

« previous php.dev (#78431) next »