Comment out xml file fragments in java IDE

It's easy to comment out and uncomment lines of Java code in any Java IDE, using shortcut keys like Ctrl-/ (in Eclipse), or Ctrl-Shift-T (in NetBeans). But I haven't found such features for XML commenting. I have to always manually add <!-- and --> even when editing those XML files inside Eclipse or NetBeans.

Why is it missing in major Java IDEs? Nowadays almost all Java projects have some XML files, like ant build files, deployment descriptors, etc. And both NetBeans and Eclipse have nice XML editing features, including syntax highlighting, element and attribute auto-completion, and element tree view. All these seem to suggest Java IDEs are serious in supporting XML development. One would think commenting/uncommenting is one of the basic requirements. Why can't I select some lines, press Ctrl-/ or Ctrl-Shift-T to comment out them?

Maybe one reason is that XML doesn't allow nested comments. So if my selection already contains XML comments, I can't add an outer comment. But even in this case, the IDE can either issue a waring, or add 2 smaller comments, one before the existing comment and the other after.


Anonymous said...

IDEA comments/uncomments XML for you with CTRL-/ (toggle line-by-line comments) and CTRL-SHIFT-/ (toggle block comments). In fact ANY file type can have associated line and block comment markers that will be applied appropriately whenever CTRL-/ or CTRL-SHIFT-/ is pressed. I often edit Python, SQL and C++ in IDEA so this is very useful.

With nested comments, the quickest way to deal with them is to select the whole area you want to comment (eg with the fantastic CTRL-W) then press CTRL-SHIFT-/ twice. The first strips existing comments, the second press will block comment the whole area. You do lose the original comment region with this approach though.

Unknown said...

With the WTP plugins installed, using the xml editor they provide, Eclipse does this easily and I use all the time.

It's the only thing I use the WTP plugin for, actually, but that's more about my lack of skills than the plugin.

gaferoz said...

Perhaps you haven't tried selecting the block of lines and them clicking the right button, then 'Source' and then 'Add Block Comment'...

Mihai Rus said...

Eclipse IDE CTRL + SHIFT + C - toggle comments in xml files

Unknown said...

You made some good points there. I did a search on the matter and found the majority of people will consent with your blog.


andrea chiu said...

I understand that every person has the passion in any aspects or things. If you love something and it came in front of you it completes your day and your mood turns into something you won't expected. I love your work and I want to read more about it. Visit my site if you have time . Thank you.



Unknown said...

Love it! Very interesting topics, I hope the incoming comments and suggestion are equally positive. Thank you for sharing this information that is actually helpful.


Unknown said...

Great and Useful Article.

Online Java Training

Java Online Training India

Java Online Course

Java EE course

Java EE training

Best Recommended books for Spring framework

Java Interview Questions

Java Course in Chennai

Java Online Training India

Unknown said...

Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more .java training in chennai

Sherlin Jones said...

The biggest change in Selenium recently has been the inclusion of the WebDriver API. Driving a

browser natively as a user would either locally or on a remote machine using the Selenium Server it

marks a leap forward in terms of browser automation.

Selenium WebDriver fits in the same role as RC did, and has incorporated the original 1.x bindings.

It refers to both the language bindings and the implementations of the individual browser controlling

code. This is commonly referred to as just "WebDriver" or sometimes as Selenium 2.
Selenium Training Institute in Chennai

Selenium Training in Chennai
Selenium Training with placement assistance in Chennai

Jones said...

When we speak of Selenium, we are actually talking about both its flavours: Selenium WebDriver and Selenium IDE. Both automate browsers in support of web application testing. WebDriver is typically used to create browser-based regression tests, whereas Selenium IDE is most advantageous in creating unit tests, exploratory tests and one-off bug reproduction scripts. There is no need to make further distinctions between the two, however, when discussing Selenium’s advantages and disadvantages.
Selenium Training in Chennai|Selenium Trianing in Velachery

Mahi Raja said...

This is an awesome post.Really very informative and creative contents.This concept is a good way to enhance the knowledge.

Dipanwita said...

I love your blog. java training in chennai

Roger Binny said...

Our digital marketing course in Chennai is targeted at those who are desirous of taking advantage of career opportunities in digital marketing. Marketing professionals who are presently using traditional marketing to meet their business objectives. Start-ups, Entrepreneurs, Business Owners who desire to make use of online media to improve their business goals and objectives.

Digital Marketing Course in Chennai
Digital Marketing Training in Chennai
Online Digital Marketing Training
SEO Training in Chennai

MOUNIKA said...

Thank you for the information.
Sap Hana Online Training
Sap Cs Online Training
Sap Bw On Hana Online Training

eMexoT said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.

Internet Of Things training in electronic city

Bhuvana said...

I accept there are numerous more pleasurable open doors ahead for people that took a gander at your site.we are providing ReactJs training in Chennai.
For more details: ReactJs training in Velachery | ReactJs training in chennai

blogs said...


sasitamil said...

After reading this web site I am very satisfied simply because this site is providing comprehensive knowledge for you to audience.
Thank you to the perform as well as discuss anything incredibly important in my opinion. We loose time waiting for your next article writing in addition to I beg one to get back to pay a visit to our website in

Selenium training in Chennai
Selenium training in Bangalore
Selenium training in Pune
Selenium Online training

lekha mathan said...

Such an excellent and interesting blog, do post like this more with more information, This was very useful, Thank you.
Aviation Academy in Chennai
Air hostess training in Chennai
Airport management courses in Chennai
Ground staff training in Chennai
aviation training in Chennai
cabin crew course in Chennai
diploma in airline and airport management in Chennai
airport ground staff training in Chennai

jvimala said...

Hey, would you mind if I share your blog with my twitter group? There’s a lot of folks that I think would enjoy your content. Please let me know. Thank you.
Java Training in Chennai | J2EE Training in Chennai | Advanced Java Training in Chennai | Core Java Training in Chennai | Java Training institute in Chennai

Venkatesh CS said...

Excellent Blog. Thank you so much for sharing.
best react js training in chennai
react js training in Chennai
react js workshop in Chennai
react js courses in Chennai
react js tutorial
reactjs training Chennai
react js online training
react js training course content
react js online training india
react js training courses
react js training topics
react js course syllabus
react js course content
react js training institute in Chennai

gokul said...

Thank you for this informative blog
Top 5 Data science training in chennai
Data science training in chennai
Data science training in velachery
Data science training in OMR
Best Data science training in chennai
Data science training course content
Data science certification in chennai
Data science courses in chennai
Data science training institute in chennai
Data science online course
Data science with python training in chennai
Data science with R training in chennai

Channel Activation said...

Starz is a US-based streaming player offering on-request shows and movies. It is available on most of the streaming devices including Amazon Fire TV, Apple TV, Apple and Android devices, Roku, and Nexus Player. Multiple users (up to 4) can get access to it if the user avails the premium subscription. To activate starz navigate to activate.starz.com ring @ +1-877-991-8710 toll-free number and get manual assistance. our agents are working 24/7 and they will assist you the moment you called.

Softgen Infotech said...

Thank you for sharing such a nice post!

Learn SAP Training from the Industry Experts we bridge the gap between the need of the industry. Softgen Infotech provide the Best SAP ABAP Training in Bangalore with 100% Placement Assistance. Book a Free Demo Today.

eTechno Soft Solutions said...

Such a great word which you use in your article and article is amazing knowledge. thank you for sharing it.

Looking for SAP HANA ADMIN Training in Bangalore, learn from eTechno Soft Solutions SAP HANA ADMIN Training on online training and classroom training. Join today!

Softgen Infotech said...

Really i appreciate the effort you made to share the knowledge. The topic here i found was really effective...

Became an Expert In Google Cloud Platform Training in Bangalore! Learn from experienced Trainers and get the knowledge to crack a coding interview, @Softgen Infotech Located in BTM Layout.

Myclasstraining said...

Great post!I am actually getting ready to across this information,i am very happy to this commands.Also great blog here with all of the valuable information you have.Well done,its a great knowledge. Real Time Experts training center bangalore

Myclasstraining said...

Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site.Real Time Experts Training in Bangalore

Myclasstraining said...

Great post!I am actually getting ready to across this information,i am very happy to this commands.Also great blog here with all of the valuable information you have.Well done,its a great knowledge.student review for Realtime Experts marathahalli bangalore

Myclasstraining said...

Great post!I am actually getting ready to across this information,i am very happy to this commands.Also great blog here with all of the valuable information you have.Well done,its a great knowledge.

sap abap training in bangalore

sap abap courses in bangalore

sap abap classes in bangalore

sap abap course syllabus

best sap abap training

sap abap training center

sap abap training institute in bangalore

Myclasstraining said...

It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful

sap hana courses in bangalore

sap hana classes in bangalore

sap hana training institute in bangalore

sap hana course syllabus

best sap hana training

sap hana training centers

best sap hana training

Myclasstraining said...

Great post!I am actually getting ready to across this information,i am very happy to this commands.Also great blog here with all of the valuable information you have.Well done,its a great knowledge.

sap hr courses in bangalore

sap hr classes in bangalore

sap hr training institute in bangalore

sap hr course syllabus

best sap hr training

sap hr training centers

sap hr training in bangalore

Myclasstraining said...

Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site.

sap mm training in bangalore

sap mm courses in bangalore

sap mm classes in bangalore

sap mm training institute in bangalore

sap mm course syllabus

best sap mm training

sap mm training centers

Myclasstraining said...

Learned a lot of new things from your post! Good creation and HATS OFF to the creativity of your mind

sap fico training in bangalore

sap fico courses in bangalore

sap fico classes in bangalore

sap fico training institute in bangalore

sap fico course syllabus

best sap fico training

sap fico training centers

Danishsingh said...

Thanks for sharing such a great blog Keep posting.
Indian company database free download
marketing automation software for small business

SAP Training said...

very informative psot..
Manual Testing Training in Chennai
QTP Training in Chennai
Software Testing Training in Chennai
LoadRunner Training in Chennai
Mobile Application Testing Training in Chennai
QC Training in Chennai
Test Complete Training in Chennai
JMeter Training in Chennai
SAP Training in Chennai
SoapUI Training in Chennai

steve said...

Travel Tours To India
Lite Wings Travels – The Travel Company creates 100% tailor-made tours to the Indian Subcontinent. Whatever your travel interests are – wildlife, local culture & food, history, blissful beaches, solo trips, luxury and adventure or any combination of these, we at Lite Wings Travels are here to design a customized Indian Subcontinent holidays for you.

Jerome Devu said...

Pretty Good Article!
At devu.in, we provide training in Data Science Training in Bangalore

Keerthi55 said...

oracle bpmonline course
angular jsonline course
sql server dbaonline course
oracle golden gateonline course

Diyalabs said...

Thanks for sharing such a helpful, and understandable blog. I really enjoyed reading it.

Robots for kids
Robotic Online Classes
Robotics School Projects
Programming Courses Malaysia
Coding courses
Coding Academy
coding robots for kids
Coding classes for kids
Coding For Kids