note 102429 added to class.domelement

[email protected] Mon, 14 Feb 2011 00:37:23 -0800
Newsgroups php.notes
Message-ID <[email protected]>
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;
    }
----
Server IP: 69.147.83.197
Probable Submitter: 58.187.172.180
----
Manual Page -- http://www.php.net/manual/en/class.domelement.php
Edit        -- https://master.php.net/note/edit/102429
Del: integrated  -- https://master.php.net/note/delete/102429/integrated
Del: useless     -- https://master.php.net/note/delete/102429/useless
Del: bad code    -- https://master.php.net/note/delete/102429/bad+code
Del: spam        -- https://master.php.net/note/delete/102429/spam
Del: non-english -- https://master.php.net/note/delete/102429/non-english
Del: in docs     -- https://master.php.net/note/delete/102429/in+docs
Del: other reasons-- https://master.php.net/note/delete/102429
Reject      -- https://master.php.net/note/reject/102429
Search      -- https://master.php.net/manage/user-notes.php