What is a free alternative to the built-in Eclipse XML editor?
The one packaged with the IDE has two major problems with formatting:
White space between elements is not honored:
<foo> text </foo>
will be formatted to:
<foo>text</foo>
We are using Eclipse 3.4.
Issue #1 is a known bug: Formatting issues with entities in XML files.
Apparently the white space formatting is intended functionality. I have requested this be provided as an option or advise on fixing this in a plugin of my own, but as of yet, no answer.
This is way less than ideal, and I hope someone has a better solution, but it works:
Build a simple App using dom4j:
public static void main( final String[] args ) throws Exception {
String text = FileUtils.readFileToString( new File( args[ 0 ] ) );
OutputFormat format = OutputFormat.createPrettyPrint();
format.setTrimText( false );
XMLWriter writer = new XMLWriter( System.out, format );
writer.write( DocumentHelper.parseText( text ) );
}
Create a runnable jar, (optional) batch script, and add as an external tool. Of course, you could try XMLTidy or some other command line XML formatter, but I have had better results with dom4j.
I like Notepad++ with the XML Tools plugin. It does XSLT, has an XPATH expression evaluator, and does DTD and schema validation. Toolchain download links:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With