Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a large XML file with many elements like this:

<Foo Bar="Baz">
</Foo >

I want them all to become like this:

<Foo Bar="Baz" />

Is there a tool that will do this for me automatically?

share|improve this question
Might be possible using Regular Expressions, but with nested tags and all it can get pretty hairy. A proper XML parser would be a better bet. – Karan Mar 8 '13 at 19:42
Yes, exactly my thoughts. I could code up a utility myself in something like C#, Java, or Python, but I think that surely such a thing must already exist. And yet, I can not find one :/ – Daryl Mar 8 '13 at 19:51
Try XMLStarlet or similar apps that support XPath etc. – Karan Mar 8 '13 at 19:53

You must log in to answer this question.

Browse other questions tagged .