>> If so, would that break over details like attributes out of order?
>
> ah - good catch - i'll check on that.  my alternate approach,  
> comparing xmlsimple data structures will not, i believe, suffer from  
> that, but i wanted to avoid a dependancy.

I caught it because I just recently solved a subset of your problem. 
assert_xhtml uses Nokogiri to match a subset of HTML within a page. The code is 
too weird for you to use, but I indeed had to defeat all the issues you will 
encounter!