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.
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 <a/><b/> becomes in 6.7.1 <a/> <b/> but is unchanged in NetBeans 6.8. The 6.7.1 behaviour is much preferred.
This issue extends beyond self closing tags. Formatting does not work at all with any XML. Formatting: <ParentTag> <childTag>Value</childTag> </ParentTag> OR <ParentTag><childTag>Value</childTag></ParentTag> Should result in <ParentTag> <childTag>Value</childTag> </ParentTag> 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.
Same thing happens on Linux, I don't think this is platform dependant.
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.
I'd like to NetFIX 1 this bug. Is it possible? 1 http://wiki.netbeans.org/NetFIX. 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.
Created attachment 93024 [details] proposed patch to xml.text module
Vladimir, please review the proposed patch. If it's Ok just apply it. Otherwise send questions to submitter.
dynamite, please, attach all updated files in one jar, instead of diff file only.
This issue is being netfixed.
Created attachment 93820 [details] updated patch of xml.text
Created attachment 93821 [details] jar containing changed files from xml.text
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.
added check: !preserveNesting_outdent.isEmpty() && preserveNesting_outdent.getLast() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ for case: -------------------------------- <root> <test attr="replace"></test> </a> </root> --------------------------------
fixed in main: f9c38cef9123
Thanks a lot Vladimir for review & integration. And especially thanks Daniel for your patch!
Integrated into 'main-golden', will be available in build *201002050200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/f9c38cef9123 User: Vladimir Yaroslavskiy <yaroslavskiy@netbeans.org> Log: [Bug #177192] [68cat] XML formatting no longer fully indents