Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 365360

Summary: Code formatting of ant xml files doesn't respect CDATA elements that contain tags (xml, html, etc)
Product: [Eclipse Project] Platform Reporter: Beau Scott <beau.scott>
Component: AntAssignee: Platform-Ant-Inbox <platform-ant-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3    
Version: 3.7.1   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard: stalebug

Description Beau Scott CLA 2011-12-01 15:14:31 EST
-- Configuration Details --
Product: Eclipse 1.4.1.20110909-0613 (org.eclipse.epp.package.java.product)
Installed Features:
 org.eclipse.platform 3.7.1.r37x_v20110729-9gF7UHOxFtniV7mI3T556iZN9AU8bEZ1lHMcVK

When formatting an ant file that contains a CDATA section with XML-style tags, the formatter over outdents subsequent nodes.

Sample build.xml (before formatting [and formatted as it *should* appear after formatting):
------------------
@ 
<?xml version="1.0" encoding="UTF-8"?>
<project name="myproject">
  <target name="main">
    <echo>
      <![CDATA[<tag>Some Nested XML</tag>]]>
    </echo>
    <echo>I should be parallel with the other echo tag above</echo>
  </target>
</project>
@
------------------

File *after* formatting:
------------------
@
<?xml version="1.0" encoding="UTF-8"?>
<project name="myproject">
  <target name="main">
    <echo>
      <![CDATA[<tag>Some Nested XML</tag>]]>
    </echo>
  <echo>I should be parallel with the other echo tag above</echo>
</target>
</project>
@ 
------------------

Notice the second echo tag is outdented one level more than it should be, as is the rest of the document.
Comment 1 Lars Vogel CLA 2019-11-14 03:09:18 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.