This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 92272 - XML editor reformat feature should break up one big line XML into multiple lines
Summary: XML editor reformat feature should break up one big line XML into multiple lines
Status: REOPENED
Alias: None
Product: xml
Classification: Unclassified
Component: Code (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker with 1 vote (vote)
Assignee: issues@xml
URL:
Keywords:
: 97513 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-01-11 03:06 UTC by J Xu
Modified: 2008-01-16 02:18 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description J Xu 2007-01-11 03:06:05 UTC
XML editor should have an auto-format/indent feature.  Basically a new button 
is needed on the XML editor that will re-format/auto-indent/beautify a well-
formed XML document.
Comment 1 Nam Nguyen 2007-01-11 03:27:59 UTC
The auto-format feature is already there: do right click context menu command
'Reformat Code', consistent with java editor.
Comment 2 J Xu 2007-01-11 03:56:23 UTC
I didn't see the menu item there, but Ctrl-Shift-F does do the auto-indent.  The
problem is that it only works when an XML already has CRLFs in it.  If the XML
is just one big line, it does not "beautify" the XML.
Comment 3 Nam Nguyen 2007-01-11 04:10:17 UTC
The menu is shown when you right click on the xml source text.

Yes, the big line is not broken up by the reformat.  It behave the same way as
java editor.  I don't know why, but yes, I agree that it is desirable that the
reformat would break down big line too.  Maybe you need to change the issue
summary line just not to confuse future evaluator.
Comment 4 J Xu 2007-01-11 04:19:13 UTC
To make it symmetry, we may also want to have a feature that strips off all
whitespaces from an XML and make it one big line.  This reverse formatting
feature  might be useful to create XML documents for testing purpose.
Comment 5 J Xu 2007-01-11 04:23:09 UTC
Changed summary line.
Comment 6 Nikita Krjukov 2007-04-12 12:50:08 UTC
I've looked over the issues which relate to autoformatting of XML and have 
found this issue as most general. So I suggest to consider the following issues 
as dependant: #89769, #93642, #82517, #97513.

I think a kind of configuration settings are required to the user will be able 
to specify a desired autoformat rules. They could be following:
-- Split the lines which are longer then a specified maximum length;
-- Put specific kinds of lines like prefixes of import declarations to separate 
lines;
-- Remove redundant spaces; 
and so on. 

Also a part of such rules can be applied automatically for an inserted part of 
XML. It seems such a feature in called "autoindent" in the Java editor. 
It could be helpful when a new import is added to the XML file. 
The issue #97513 requires that a new prefix declaration appeares on separate 
line. But it's undesirable ot autoformatting the whole XML document in such 
case. 
Comment 7 Nikita Krjukov 2007-04-12 12:57:33 UTC
*** Issue 97513 has been marked as a duplicate of this issue. ***
Comment 8 Murali Pottlapelli 2007-04-12 19:20:23 UTC
I raised priority as it causing productivity loss.
Comment 9 cayhorstmann 2008-01-16 02:18:19 UTC
This issue is particularly vexing in the JSP tab of the visual JSF editor. The lines get v e r y  v e r y long, and it
takes an inordinate amount of horizontal scrolling to edit them. Please fix this!