I’ve just started reading Ruby Best Practices and the TDD chapter pointed out how best to test complex XML output. I found myself in a similar situation in Flex the other day so it was relieving to read that my solution paralleled the solution presented in the book.
You can read the relevant section from the free copy of the first chapter posted on Github. See page 22.
The reader’s digest version: parse the XML and then set up a series of tests to check the XML DOM for the important elements. The advantage is you’re not doing a brittle string comparison between two pieces of XML nor are you writing an enormous test that checks for every piece of data in the XML. This keeps each test small and understandable as well as making it easy to see where your problem is should a test fail.