views:

3074

answers:

5

Does anyone know of a free alternative to the built in Eclipse XML editor?

The one that is packaged with the IDE has 2 major problems with formatting that my team and I have discovered when formatting:

  • The formatter tries to parse escaped char's as though they were unescaped. e.g. ' & l t ;' is treated like '<' which causes the formatter to "stop" (note there isn't really white space between the chars)
  • White space between elements is not honored. ex:

<foo> text </foo>

will be formatted to:

<foo>text</foo>

We are using Eclipse 3.4

Thanks in advance.

[[EDIT #1: Issue #1 is a known bug found here: Formatting issues with entities in XML files]]

[[EDIT #2: Apparently the white space formatting is intended functionality. See here. 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.]]

+2  A: 
VonC
I have the 'Eclipse XML Editors and Tools 3.0.3' installed already.Have you tried creating a tag with white space in the data and then formatting? How about escape chars? If it works for you then I wonder if it is some setting...
javamonkey79
+1  A: 

I have used XMLBuddy in the past http://www.xmlbuddy.com/

before I reverted to OxygenXML but you have to pay for Oxygen.

Deep Kapadia
XMLbuddy is not free so far as I can tell.
javamonkey79
p.s. I'd happily pay for\expense a full featured plugin if that is what I needed. However, I just need simple formatting and outline presentation.
javamonkey79
+2  A: 

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.

javamonkey79
+2  A: 

Hi! You can try this one if you like... http://editorxml.sourceforge.net/

Best Regards

Metal Fan