Format Adobe Experience Manager dialog .content.xml files with one attribute per line — instantly.

Features
One Attribute Per Line
Expands every XML element with 2 or more attributes into the canonical AEM dialog format — each attribute on its own indented line, closing /> appended to the last attribute.
Before:
<videoId jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/textfield" fieldLabel="YouTube Video ID" name="./videoId"/>
After:
<videoId
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="YouTube Video ID"
name="./videoId"/>
Root Element Namespace Handling
Keeps all xmlns:* declarations on the opening tag line — consistent with AEM FileVault conventions.
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
jcr:title="My Component"
sling:resourceType="cq/gui/components/authoring/dialog"
maximize="{Boolean}true">
Smart Single-Attribute Preservation
Structural nodes with only one attribute stay compact — no unnecessary noise.
<items jcr:primaryType="nt:unstructured">
Inline comments are preserved at their correct indentation depth.
<!-- ══════════ TAB 1: CONTENT ══════════ -->
Error Notification
Invalid XML shows a clear error message in the VSCode notification area — document is left unchanged.
Usage
- Open any
.content.xml file in VSCode
- Press
Shift+Alt+F (Format Document)
- If prompted to select a formatter, choose AEM Dialog XML Formatter
Scope: Only activates for files named .content.xml. Other XML files are unaffected.
Requirements
- VSCode
^1.60.0
- No external tools or runtimes required — fully self-contained
Extension Settings
No configuration needed. Works out of the box.
To set as default formatter for .content.xml files, add to your VSCode settings.json:
"[xml]": {
"editor.defaultFormatter": "ChiruSandeepPaleti.aem-dialog-formatter"
}
Supported AEM Versions
- AEM 6.5 (FileVault / JCR content packages)
- AEM as a Cloud Service
- Any AEM project using standard
.content.xml dialog structure
Known Limitations
- CDATA sections: preserved but not specially formatted
- Attribute ordering: preserved as-is from source (not alphabetized)
Release Notes
1.0.0
- Initial release
- One-attribute-per-line formatting via
@xmldom/xmldom
- Root element namespace handling
- Comment preservation
- Error notification for invalid XML
Contributing
Bug reports and feature requests welcome at GitHub Issues.
License
MIT
Developed by Chiru Sandeep Paleti