Posted by R. Rajesh Jeba Anbiah on 11/18/49 11:55
Paul Lautman wrote:
> Within a subsection of an HTML document (not a complete page), there will be
> a few spans with the class "room_headings"
> e.g.
> <span class="room_headings"> Double
> Room</span>
>
> Can folks suggest some nice ways of extracting all the text contents of such
> spans into a list (for use in a drop-down select list)?
XPath can be used if the contents are valid XML:
$xml = new SimpleXMLElement( '<foo><span
class="room_headings">DoubleRoom</span> <span
class="room_headings">DoubleRoom</span><span
class="room_headings1">DoubleRoom</span></foo>');
print_r($xml->xpath('//span[@class="room_headings"]'));
--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
Navigation:
[Reply to this message]
|