Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 361708 - "Preserve whitespace in tags with PCDATA content" doesn't seem to be working.
Summary: "Preserve whitespace in tags with PCDATA content" doesn't seem to be working.
Status: RESOLVED INVALID
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xml (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: wst.xml CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-21 17:01 EDT by Missing name CLA
Modified: 2011-10-21 17:43 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Missing name CLA 2011-10-21 17:01:35 EDT
Build Identifier: 20110615-0604

Assuming I understand just what PCDATA content is, then the "Preserve whitespace in tags with PCDATA content" option in "Window->Preferences->XML->XML Files->Editor" doesn't seem to be stopping the xml formatter from inserting extra whitespace (e.g. line breaks) into tags with PCDATA content.

With that option checked, and with line width set to 5, I format the following xml (using Shift-Ctrl-F).

<?xml version="1.0" encoding="UTF-8"?>
<test><line1>This is a test of <i>the</i> emergency broadcasting system.</line1><line2>This is only a test.</line2></test>

I expect something like this...

<?xml version="1.0" encoding="UTF-8"?>
<test>
   <line1>This is a test of <i>the</i> emergency broadcasting system.</line1>
   <line2>This is only a test.</line2>
</test>

but what I get is this...

<?xml version="1.0" encoding="UTF-8"?>
<test>
   <line1>
      This
      is
      a
      test
      of
      <i>
         the
      </i>
      emergency
      broadcasting
      system.
   </line1>
   <line2>
      This
      is
      only
      a
      test.
   </line2>
</test>


Reproducible: Always

Steps to Reproduce:
1. Create an xml file with the above contents.
2. In XML editor settings, change line width to "5" and check "Preserve whitespace in tags with PCDATA content".
3. Open the file you created and format it by typing Shift-Ctrl-F.
Comment 1 Missing name CLA 2011-10-21 17:13:42 EDT
Comment formatting seems to have added a line break in the test case I put in the initial post. Before formatting, the xml file has only two line breaks, one before the <test> start tag and one after the </test> end tag which ends the document.
Comment 2 Nitin Dahyabhai CLA 2011-10-21 17:43:29 EDT
That feature requires you to reference a grammar that declares the element as having #PCDATA for content.  See http://en.wikipedia.org/wiki/Document_Type_Definition#Element_type_declarations .