You are here: Re: Problem about DOMNodes Value « PHP Programming Language « IT news, forums, messages
Re: Problem about DOMNodes Value

Posted by Janwillem Borleffs on 11/13/05 11:53

Fabien M wrote:
> i'm working on a script which uses DOM fonctions of PHP5.
> I've got a Node which looks like that :
> <div>some text <a href="...">link</a><span> some text2</span></div>
>
> When I use nodeValue, php returns "some text link some text2".
> How can I get all childs of this node?
> If you prefer, which method to use to get "<div>some text <a
> href="...">link</a><span> some text2</span></div>" ?
>

<?php

$html = '<html><div>some text <a href="...">link</a>';
$html .= '<span> some text2</span></div></html>';
$dom = new DomDocument;
$element = $dom->loadHTML($html);

$div = $dom->getElementsByTagName('div')->item(0);
print htmlentities($dom->saveXML($div));

?>


JW

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация