Hi all, I've asked simular questions before, but I think I'm finally asking the *right* question to get the right answer.
I'm look for some suggestions on the best method of parsing a HTML document (or part thereof), with the view of CAPTURING and MODIFYING a specific element of a specific tag. something like: 1. look for a given tag eg DIV 2. capture the tag (everything from '<DIV' up to the '>') 3. look for a given attribute (eg ID="foo", ID=foo, ID='foo' -- all valid ways) 4. capture it 5. be given the opportunity to manipulate the attribute's value, delete it, etc 6. place captured tag (complete with modifed elements) back into the string in it's original position 7. return to step 1, looking for the next occurence of a DIV tag I really don't know where to start. I REALLY don't expect someone to write this for me, just some guidance would be great -- or maybe some inspiration :) I guess what I'd like to be able to do, in pseudo code is: while (getTag('DIV',$myHTML)) { while(getAttribute('ID')) { // manipulate if($attribute == "foo") { $attribute == "foo2"; } } } while (getTag('DIV',$myHTML)) { while(getAttribute('ID')) { deleteAttribute(); } } The solution might be a helluva lot more complex, or may be OOP based. Any inspiration/links/words of wisdom? Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php