Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to stop Eclipse (3.7) from messing up content of <xsd:documentation> tags?

Tags:

xml

eclipse

xsd

If I write multi-line documentation in an XML schema using the properties view it creates <xsd:documentation> tags to contain it.

Whenever I format the file (CTRL+SHIFT+F) all lines but the first are indented and sometimes wrapped due to this indentation.

This indentation and wrapping effectively ruins every effort of generating a nice looking documentation from the file. Especially if I want to document a table of allowed values.

Before format:

<xsd:documentation>1st line of comment
2nd line is indented and also wrapped as it exceeds the max line length setting.
3rd line is just indented.
</xsd:documentation>

After format:

<xsd:documentation>1st line of comment
    2nd line is indented and also wrapped as it exceeds the max line 
    length setting.
    3rd line is just indented.
</xsd:documentation>

The "Format comments" option in Preferences -> XML -> XML files -> Editor does not help with the indentation. Increasing "Line width" on the same preferences page fixes wrapping but I really want the editor to NOT format my the contents of my documentation elements.

like image 631
cb2 Avatar asked Oct 07 '11 08:10

cb2


1 Answers

You could add an xml atribute xml:space="preserve" to xsd:documentation to tell that spaces must be preserved. For example:

<xsd:documentation xml:space="preserve" >1st line of comment
    2nd line is indented and also wrapped as it exceeds the max line length setting.
    3rd line is just indented.
</xsd:documentation>
like image 179
PhoneixS Avatar answered Sep 28 '22 19:09

PhoneixS