Hi,
I am trying to use DOMdocument to find <edit> tags in my HTML.
When I use an <edit> tag on it's own it works fine and finds all the information I require
On the odd occasion, I am required to put my <edit> tags inside quotes (as per my second example commented out) which falls over. I'm assuming it does not like the quotes and is bombing out
Can anyone shed some light on if this is possible? or will this simply not work with the DOMdocument due to it's structure? I understand its' not the norm.
Many Thanks,
MoFish
<?php
// works
$html = "<edit name='source' label='Source' help='boom' />";
// doesnt work
// $html = "<img src='<edit name='source' label='Source' help="boom" />' />";
$dom = new DOMDocument();
$dom->loadHTML($html);
$edits = $dom->getElementsByTagName('edit');
foreach ($edits as $edit) {
foreach ($edit->attributes as $attr) {
echo "Name '$attr->nodeName' | Value '$attr->nodeValue'<br />";
}
}
?>