note 102430 rejected from class.domelement by danbrown

From: Date: Mon, 14 Feb 2011 13:32:43 +0000
Subject: note 102430 rejected from class.domelement by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-176985@lists.php.net to get a copy of this message
Note Submitter: happylot.info ---- I use this code to get content of tag, but the result return <h1 class="Title">Some text...</h1> function getTags( $dom, $tagName, $attrName, $attrValue ){ $html = ''; $domxpath = new DOMXPath($dom); $newDom = new DOMDocument; $newDom->formatOutput = true; $filtered = $domxpath->query("//$tagName" . '[@' . $attrName . "='$attrValue']"); $i = 0; while( $myItem = $filtered->item($i++) ){ $node = $newDom->importNode( $myItem, true ); // import node $newDom->appendChild($node); // append node } $html = $newDom->saveHTML() ; return $html; } How can I get only "Some text..."

« previous php.notes (#176985) next »