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

Bug 314293

Summary: XML formatter inserts newline in XML header
Product: [WebTools] WTP Source Editing Reporter: Matthew Adams <matthew>
Component: wst.xmlAssignee: Rakesh <rakes123>
Status: RESOLVED WORKSFORME QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: nsand.dev, pwebster
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Matthew Adams CLA 2010-05-25 11:36:45 EDT
Build Identifier: M20100211-1343

If an xml file has a header of the form

<?xml version="1.0" encoding="UTF-8"?>

and the user formats it (Shift-Ctrl-F), the formatter inserts a newline in the xml header such that it looks like

<?xml version="1.0"
      encoding="UTF-8"?>

Inserting the newline causes many parsers (like the one Ivy uses) to throw an exception.  Regardless of the formatter's settings, it should ensure to leave the standard xml header element on a single line.

Reproducible: Always

Steps to Reproduce:
1. Create an xml document with a header of <?xml version="1.0" encoding="UTF-8"?>
2. Format it.
3. Observe newline between the version and encoding attributes.
Comment 1 Rakesh CLA 2010-05-27 06:04:53 EDT
I am not able to reproduce it on I20100520-0800 build .What preferences are enabled in XML->XML Files->editor?
Comment 2 Matthew Adams CLA 2010-05-27 11:48:36 EDT
(In reply to comment #1)
> I am not able to reproduce it on I20100520-0800 build .What preferences are
> enabled in XML->XML Files->editor?

I think I've changed my settings since I first noticed the error and don't recall what they were when this first took place -- this formatting was going on unknowingly by us for some time before we discovered it.  The fact that it was happening on when editing Maven POM files in the POM editor might have something to do with it.

With my current settings, I cannot reproduce the behavior either now.  :(
Comment 3 Rakesh CLA 2010-07-12 05:07:51 EDT
Resolving it , since it is not reproducible.Please reopen if you are able to reproduce.