There's a lot of xml out there, and diffing it against canned data has helped me in the past.

But there's a few things I find I need to do:

  • Delete segments of the xml I don't care about (timestamps)
  • Sort certain xpaths by some key (a relative child xpath)
  • Indent and 'Normalise' the xml =

I've written this a few times at various companies. Is there something out there in the open source world we can use to avoid me writing it again at the next company?

Also, what are your experiences with testing xml?

  • I bet there's a million XML beautifiers out there :)
    – corsiKa
    Jul 7, 2011 at 22:47
  • Nothing except for the last sentence of your question is specific to testing. While there is nothing wrong with posting your question here, you may find more answers in a different forum, e.g. StackOverflow.
    – user246
    Jul 10, 2011 at 19:16
  • If you have written it a few times why don't you write an open source an implementation, chuck it on google code/github/whereever and just grab it each time you use it? The more you use it the more mature and stable it gets and it can be reused every time you get a new gig. Finally others get to enjoy it as well.
    – Ardesco
    Jul 12, 2011 at 10:40

3 Answers 3


One example of software that could be used for xml testing:


I think the only thing missing is being able to sort an xpath based on a child xpath.


      <b key="bee"></b>
      <a key="apple"></a>

I'd like to sort /xml/* using ./@key


If you've written it yourself, why don't you keep a copy of it for yourself and just add it to your toolkit wherever you go? It would probably be more robust and extensible than any other solution.

  • Sorry - I'm a stickler - Would have to be from memory. I try and keep above board regarding copyright.
    – Squirrel
    Jul 9, 2011 at 5:57

If you are willing to use Lisp, I suggest looking at the XML parsing and writing functions in Clojure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.