Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
1  
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.