# XML

IntelliJ IDEA brings powerful support for XML that includes [structure validation](validating-web-content-files.html), [formatting](reformat-and-rearrange-code.html) (`Ctrl+Alt+L` (Windows), `⌘ ⌥ L` (macOS), `⌘ ⌥ L` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ L` (macOS System Shortcuts), `Ctrl+Alt+L` (XWin), `Ctrl+Alt+L` (GNOME), `Alt+Shift+L` (KDE), `Ctrl+Alt+L` (Emacs), `Ctrl+Alt+L` (Sublime Text), `⌘ ⌥ L` (Sublime Text (macOS)), `Alt+Shift+F` (NetBeans), `Ctrl+Alt+Enter` (Visual Studio), `⌘ ⌥ ⏎` (Visual Studio (macOS)), `Ctrl+Alt+L` (Eclipse), `⌘ ⇧ F` (Eclipse (macOS))) and [indentation](indentation.html) (`Ctrl+Alt+I` (Windows), `⌃ ⌥ I` (macOS), `⌘ ⌥ I` (IntelliJ IDEA Classic (macOS)), `⌃ ⌥ I` (macOS System Shortcuts), `Ctrl+Alt+I` (XWin), `Ctrl+Alt+I` (GNOME), `Ctrl+Alt+I` (KDE), `Ctrl+Alt+I` (Emacs), `Ctrl+Alt+I` (Sublime Text), `⌃ ⌥ I` (Sublime Text (macOS)), `Ctrl+Alt+I` (NetBeans), `Ctrl+Alt+I` (Visual Studio), `⌃ ⌥ I` (Visual Studio (macOS)), `Ctrl+I` (Eclipse), `⌘ I` (Eclipse (macOS)) according to the [XML code style](settings-code-style-xml.html), [importing unbound namespaces](#import-xml-namespace), [viewing code structure](viewing-structure-of-a-source-file.html) ,  [unwrapping and
removing tags](working-with-source-code.html#editor_statement_select)  (`Ctrl+Shift+Delete` (Windows), `⌘ ⇧ ⌦` (macOS), `⌘ ⇧ ⌦` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ ⌦` (macOS System Shortcuts), `Ctrl+Shift+Delete` (XWin), `Ctrl+Shift+Delete` (GNOME), `Ctrl+Shift+Delete` (KDE), `Ctrl+Shift+Delete` (Emacs), `Ctrl+Shift+Delete` (Sublime Text), `⌘ ⇧ ⌦` (Sublime Text (macOS)), `Ctrl+Shift+Delete` (NetBeans), `Ctrl+Shift+Delete` (Visual Studio), `⌘ ⇧ ⌦` (Visual Studio (macOS)), `Alt+R` (Eclipse), `Ctrl+Shift+Delete` (Eclipse (macOS))), generating [DTD files](generating-dtd.html) and [schemas from instance
documents](generating-xml-schema-from-instance-document.html), as well as syntax and error highlighting, [code completion](auto-completing-code.html) (`Ctrl+Space` (Windows), `⌃ Space` (macOS), `⌃ Space` (IntelliJ IDEA Classic (macOS)), `⌃ Space` (macOS System Shortcuts), `Ctrl+Space` (XWin), `Ctrl+Space` (GNOME), `Ctrl+Space` (KDE), `Alt+/` (Emacs), `Ctrl+Space` (Sublime Text), `⌃ Space` (Sublime Text (macOS)), `Ctrl+Space` (NetBeans), `Ctrl+Space` (Visual Studio), `⌃ Space` (Visual Studio (macOS)), `Ctrl+Space` (Eclipse), `⌃ Space` (Eclipse (macOS))), [intention actions](intention-actions.html) (`Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (NetBeans), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS))), [quick
documentation look-up](viewing-reference-information.html#inline-quick-documentation)  (`Ctrl+Q` (Windows), `F1` (macOS), `⌃ J` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Ctrl+Q` (XWin), `Ctrl+Q` (GNOME), `Ctrl+Q` (KDE), `Ctrl+Q` (Emacs), `Ctrl+Q` (Sublime Text), `Ctrl+Q` (Sublime Text (macOS)), `Ctrl+Q` (NetBeans), `Ctrl+K, I` (Visual Studio), `⌘ K, I` (Visual Studio (macOS)), `Alt+Middle-Click` (Eclipse), `⌥ Middle-Click` (Eclipse (macOS))), and more.

IntelliJ IDEA uses Xerces 2.11, an XML parser developed by Apache Software Foundation Group.

## Import XML namespaces

If you use a tag or an attribute from a namespace that is not bound, IntelliJ IDEA detects the problem and shows a tooltip.

![Tooltip: Reference to an unbound namespace](https://resources.jetbrains.com.cn/help/img/idea/2026.2/import_unbound_namespace_tooltip.png)

To solve the problem, use the quick-fix that IntelliJ IDEA suggests.

Procedure:

* Press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (NetBeans), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)). If there are multiple choices, select the required namespace from the list.

[Video](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_unboundNameSpace2.mp4)

* Alternatively, hover over the problem and click Create namespace declaration in the popup that opens.   If there are multiple choices, select the required namespace from the list.

[Video](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_unboundNameSpace1.mp4)

Depending on the file type, IntelliJ IDEA creates a namespace declaration, or a taglib.

## Configure syntax highlighting

You can configure XML-aware syntax highlighting according to your preferences and habits.

Procedure:

1. In the Settings dialog (`Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))), go to `Editor | Color Scheme | XML`.

2. Select the color scheme, accept the highlighting settings inherited from the defaults or customize them as described in [Colors and fonts](configuring-colors-and-fonts.html).

