FormatterHQ

MXML Viewer

Open an Apache Flex or Adobe Flex .mxml file and see its component hierarchy as a tree, with the markup formatted next to it. Handy when a legacy project lands on your desk.

Input XML
Output XML
Ready.

How to use the MXML Viewer

  1. Upload or drop an .mxml file, paste its contents, or click Sample for a small Spark application.
  2. Click View to see the component tree in the Tree tab.
  3. Open the Code tab or click Format for indented markup, choosing an Indent.
  4. Copy or download the formatted file.

An MXML viewer for Flex projects

MXML is the XML-based markup language of Adobe Flex, now Apache Flex, used to declare user interfaces for Flash and AIR applications. Many of those applications are still in maintenance or being migrated, and their .mxml files are often compressed onto a few long lines by build tools or old editors. This MXML viewer shows the component hierarchy as a tree and formats the markup so you can read it without installing a Flex SDK or IDE.

Anatomy of an MXML file

A Flex 4 application typically declares three namespaces on its root:

  • fx (http://ns.adobe.com/mxml/2009) for language tags such as <fx:Script>, <fx:Declarations> and <fx:Style>.
  • s (library://ns.adobe.com/flex/spark) for Spark components like <s:Button> and <s:VerticalLayout>.
  • mx (library://ns.adobe.com/flex/mx) for the older MX (Halo) components.

ActionScript code lives inside <fx:Script>, almost always wrapped in a CDATA section so that < and && in the code do not break the XML.

Example

<?xml version="1.0" encoding="utf-8"?><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"><fx:Script><![CDATA[ private function greet():void { label1.text = "Hi"; } ]]></fx:Script><s:layout><s:VerticalLayout gap="10"/></s:layout><s:Button label="Greet" click="greet()"/><s:Label id="label1"/></s:Application>

Formatted with 2 spaces:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark">
  <fx:Script><![CDATA[ private function greet():void { label1.text = "Hi"; } ]]></fx:Script>
  <s:layout>
    <s:VerticalLayout gap="10"/>
  </s:layout>
  <s:Button label="Greet" click="greet()"/>
  <s:Label id="label1"/>
</s:Application>

The script block is kept exactly as written; the formatter does not touch code inside CDATA.

Reading the component tree

In the Tree tab, the root s:Application lists its namespace declarations and attributes first (prefixed with @, such as @minWidth), followed by child components under their full prefixed names. Event handlers like @click and ids like @id are attributes, so you can quickly see which components are wired to code. The script appears as a plain text value under fx:Script.

This makes the tree useful for migration work: you can list the components a screen uses, spot MX components that still need replacing, and find id values referenced from ActionScript.

Errors in MXML

MXML must be well-formed XML. The usual culprits are ActionScript outside a CDATA block (a < comparison ends up parsed as a tag) and a raw & in text. The status bar gives the line and column. Checks specific to Flex, such as unknown component names or type errors, need the Flex compiler.

Related tools

For general XML files, the XML viewer offers the same tree with Minify. If you are moving a Flex UI to .NET, the XAML beautifier formats the target markup, and the XML parser lets you change the attribute prefix in the tree.

Frequently asked questions

What is an MXML file?
MXML is the declarative XML markup of Adobe Flex and Apache Flex. It describes components, layouts, styles and data bindings, and is compiled together with ActionScript into a SWF for Flash Player or AIR.
Can this tool run or compile my Flex application?
No. It only views and formats the markup. Compiling MXML requires the Apache Flex SDK or a compatible compiler.
Does formatting change my ActionScript code?
No. Code inside fx:Script CDATA sections is output exactly as written, including its spacing and line breaks.
Can I open MXML files from Apache Royale?
Yes, as long as the file is well-formed XML. The tree and formatter work on any namespaces, so Royale component prefixes are displayed just like Spark and MX ones.

Last updated September 26, 2026

Related tools

BBCode Viewer Preview BBCode forum posts before publishing: bold, colours, links, quotes, lists, code and spoilers rendered live. CSV Viewer View CSV files as a clean, sortable-looking table in your browser. Auto-detects commas, semicolons, pipes and tabs. Excel Viewer Open and view Excel (.xlsx, .xls), OpenDocument (.ods) and CSV spreadsheets online without Excel. Sheet tabs, merged cells and JSON tree. EXIF Viewer Read EXIF, GPS, XMP, IPTC and ICC metadata from photos — camera, lens, exposure, date and location — without uploading the file. HTML Viewer Paste HTML or open a file and see it rendered instantly in a safe, sandboxed live preview. Free online HTML viewer. JSON Viewer & Beautifier View JSON as a collapsible tree and beautify it at the same time. Explore nested objects and arrays without losing your place. OPML Viewer View OPML subscription lists and outlines as a clickable, nested list. Inspect feed URLs exported from any RSS reader. RSS Feed Viewer View RSS and Atom feeds as readable articles. Paste feed XML to preview titles, links, dates and summaries. SOAP Formatter Format SOAP request and response envelopes online. Beautify headers and body, validate the XML and pinpoint errors. WSDL Formatter Format WSDL files online. Beautify web service definitions with messages, port types, bindings and services neatly indented. XAML Beautifier Beautify XAML for WPF, UWP, WinUI, MAUI and Avalonia. Indent layouts, controls and bindings consistently and validate the markup. XML Editor Edit XML online with syntax highlighting, live validation and a tree preview. Format, minify and download your changes.