Is there a format XML command?

Answered

I can't seem to find any command to reformat the xml I am working on. Often I may cut and paste pieces of XML to create a new XML file but the indentation on different pieces may be inconsistent so I was expecting there would be a command to reformat the file, but I can't seem to find one anywhere. For now I have been copying the whole thing into my XML editor (XMLBluePrint) reformatting it there then pasted the reformatted code back into IDEA, seems like a lot of work so I must be missing something.

I'm using IDEA 15.0.1 Ultimate

Thanks for any pointers.,

3
9 comments

Right in the main menu: "Code => Reformat Code" or just Ctrl-Alt-L

Or "Help => Find Action" (which is Ctrl-Shift-A), then type "format"

3

My IntelliJ seems to have stopped formatting XML. Is there a setting that might account for this?

1

Check it's mapped to the correct file type, see https://stackoverflow.com/a/13374653/104891.

0

Thanks Serge. It's a good idea, but that's not it. XML is mapped to *.xml

0

Please contact support at https://intellij-support.jetbrains.com/hc/requests/new with the sample file that doesn't format (or a project with your code style saved) plus the logs via Help | Collect Logs and Diagnostic Data.

0

Has there been a resolution to this? My IntelliJ also stopped formatting XML.

0

Jonathanl Please read the previous comment.

0

If you mean the file type mapping, I already tried that.

0

Jonathanl No, I mean the comment about reporting it to support with the sample file and the logs.

0

Please sign in to leave a comment.