Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 177192 - [68cat] XML formatting no longer fully indents
[68cat] XML formatting no longer fully indents
Product: xml
Classification: Unclassified
Component: Tools
All All
: P3 with 8 votes (vote)
: 6.x
Assigned To: Vladimir Yaroslavskiy
Depends on:
  Show dependency treegraph
Reported: 2009-11-19 05:54 UTC by dynamite
Modified: 2010-02-04 22:29 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT

proposed patch to xml.text module (30.30 KB, patch)
2010-01-02 09:11 UTC, dynamite
Details | Diff
updated patch of xml.text (28.86 KB, patch)
2010-02-03 15:21 UTC, dynamite
Details | Diff
jar containing changed files from xml.text (10.94 KB, application/java-archive)
2010-02-03 15:23 UTC, dynamite

Note You need to log in before you can comment on or make changes to this bug.
Description dynamite 2009-11-19 05:54:51 UTC
The formatting of XML documents has changed in 6.8 dev from NetBeans 6.7.1 and earlier.  Previously the formatting would move the XML elements onto their own lines and indent whenever there were multiple elements on a line.  This no longer happens.

E.g. the XML fragment


becomes in 6.7.1


but is unchanged in NetBeans 6.8.  The 6.7.1 behaviour is much preferred.
Comment 1 spencermatthewp 2009-12-14 17:07:43 UTC
This issue extends beyond self closing tags.  Formatting does not work at all with any XML.


Should result in

but formatting does nothing.

This bug is a show stopper for my company upgrading to NetBeans 6.8.  It's difficult for me to understand how an existing function could not be sufficiently regression tested in a new version.  

Please address this issue with utmost priority.
Comment 2 ogj 2009-12-17 00:32:06 UTC
Same thing happens on Linux, I don't think this is platform dependant.
Comment 3 tjcinmaryland 2009-12-23 07:34:37 UTC
And on Mac OS X 10.5/6, to echo the fact that this is clearly not platform dependent.

Considering that I often have to work through several-hundred-element XML documents from third-party vendors as a major portion of my job, the 6.7.1 functionality was a great boon.  I'd really like to not have to keep both 6.7 and 6.8 on my machine to be able to handle reading these files - the functionality *needs* to be put back into the new version ASAP, or my coworkers and I might have to switch IDEs.
Comment 4 dynamite 2010-01-02 09:01:48 UTC
I'd like to NetFIX  1 this bug. Is it possible?  1

I believe that this was caused to fix a work-around to issue #170343.  To fix this issue would require backing out that work-around and fixing XMLLexerFormatter to keep track of the use of xml:space="prevent" and xml:space="default".  This is used to indicate is contained tags should be formatted and also whether they should contribute to the indent level.  This is important in the case whether xml:space="default" is nested under xml:space="prevent".

I have spent a few hours over this Christmas break having a look at this and believe that I now have a fix (fixing the UTs for XMLLexerFormatter on the way). I have extended the UTs to include the use of xml:space and checked that it also applies to formatting selected text.

I would also like to echo the point that NB formatter is currently useless for the not uncommon case of minimized XML documents, which is a case when the formatter becomes most useful.
Comment 5 dynamite 2010-01-02 09:11:16 UTC
Created attachment 93024 [details]
proposed patch to xml.text module
Comment 6 Sergey Lunegov 2010-02-03 06:13:41 UTC
Vladimir, please review the proposed patch. If it's Ok just apply it.
Otherwise send questions to submitter.
Comment 7 Vladimir Yaroslavskiy 2010-02-03 06:21:58 UTC
please, attach all updated files in one jar, instead of diff file only.
Comment 8 Jiri Kovalsky 2010-02-03 06:53:54 UTC
This issue is being netfixed.
Comment 9 dynamite 2010-02-03 15:21:46 UTC
Created attachment 93820 [details]
updated patch of xml.text
Comment 10 dynamite 2010-02-03 15:23:06 UTC
Created attachment 93821 [details]
jar containing changed files from xml.text
Comment 11 dynamite 2010-02-03 15:25:39 UTC
I have taken the opportunity to review the proposed patch and have made a some minor changes.  This is mainly removing unused code and adding comments.

Many thanks for considering this patch.
Comment 12 Vladimir Yaroslavskiy 2010-02-04 06:28:52 UTC
added check:

!preserveNesting_outdent.isEmpty() && preserveNesting_outdent.getLast()

for case:
    <test attr="replace"></test>
Comment 13 Vladimir Yaroslavskiy 2010-02-04 07:02:39 UTC
fixed in main: f9c38cef9123
Comment 14 Jiri Kovalsky 2010-02-04 07:26:23 UTC
Thanks a lot Vladimir for review & integration. And especially thanks Daniel for your patch!
Comment 15 Quality Engineering 2010-02-04 22:29:51 UTC
Integrated into 'main-golden', will be available in build *201002050200* on (upload may still be in progress)
User: Vladimir Yaroslavskiy <>
Log: [Bug #177192] [68cat] XML formatting no longer fully indents

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo