XML Viewer & Formatter

Paste or upload XML — get a collapsible tree view and formatted output instantly.

Free: 500 KB limit. Go Pro →

Ctrl+Enter to parse

Parse XML to see tree view

What Is XML?

XML (Extensible Markup Language) is a W3C-standardized markup language designed for storing and transporting structured data in a platform-independent, self-descriptive format. Unlike HTML — which instructs browsers on how to display information — XML is purely about data: its structure, its relationships, and its meaning. This distinction has made XML the backbone of industry standards that require rigorous, machine-verifiable data exchange: XRechnung and ZUGFeRD in German e-invoicing, SOAP web services, OpenDocument (ODF), RSS and Atom feeds, SVG vector graphics, Maven build files, and the Office Open XML format used by Microsoft Word and Excel.

Every XML document is built from a hierarchy of elements enclosed in matched start and end tags (e.g., <Invoice>...</Invoice>). Elements can carry attributes directly within their opening tag, contain text content, hold nested child elements, or mix both. Well-formed XML must satisfy a strict set of rules: every opened tag must be closed, tags must be properly nested without overlapping, the document must have exactly one root element, attribute values must be quoted, and certain characters (<, >, &, ", ') must be escaped as XML entities. Beyond well-formedness, valid XML additionally conforms to a schema — either a DTD (Document Type Definition) or an XSD (XML Schema Definition) — which specifies exactly which elements and attributes are permitted, their data types, and their cardinality. This two-level discipline is what allows XRechnung invoices to be machine-processed reliably across dozens of different ERP systems and government portals.

In the German and EU e-invoicing landscape, XML is central to legal compliance. The XRechnung standard — mandated for invoices to federal authorities since 2020 and extended to state authorities across all German Bundesländer — is based on two XML syntaxes: UBL 2.1 (OASIS Universal Business Language) and UN/CEFACT CII (Cross-Industry Invoice). ZUGFeRD embeds CII XML as an attachment inside a PDF/A-3 document. The European EN 16931 core invoice standard underpins both, defining a set of semantic business terms (BT-1 for invoice number, BT-9 for payment due date, etc.) that are mapped to XML element paths in each syntax. Knowing how to read and navigate these XML files — using the namespace prefixes cbc: (Common Basic Components) and cac: (Common Aggregate Components) in UBL — is essential for accountants, ERP developers, and tax auditors working with public procurement systems in Germany.

How to Use This XML Viewer

Our XML Viewer is designed for developers, accountants, and IT professionals who need to quickly inspect XML documents without installing a dedicated editor.

  1. Paste or UploadPaste your XML content directly into the input field, or click "Upload File" to select an XML file from your device. The tool accepts any well-formed XML regardless of the document type — XRechnung invoices, SVG graphics, Maven pom.xml, SOAP responses, or custom XML formats.
  2. Parse & FormatClick the "Parse & Format XML" button or press Ctrl+Enter. The tool validates your XML syntax for well-formedness and, if valid, builds an interactive tree view and a cleanly indented formatted output. If your XML contains a syntax error, the tool reports the exact position of the problem.
  3. Explore the TreeNavigate the collapsible tree view to inspect element names, attributes, and text content. Click the chevron icons to expand or collapse nested sections. This is especially useful for large XRechnung invoices where you want to jump directly to the SellerParty, LineItem, or TaxTotal section without scrolling through hundreds of lines.
  4. Copy Formatted OutputUse the "Copy formatted" button to copy the cleaned, properly indented XML to your clipboard, ready to paste into a code editor, email, or documentation system.

All processing happens entirely in your browser using the fast-xml-parser JavaScript library. Your XML data never leaves your device, is never uploaded to a server, and is never stored anywhere. This makes the tool fully GDPR-compliant for processing sensitive business documents. Free users can process files up to 500 KB; Pro users have no size limit.

How It Works

When you click "Parse & Format XML", the browser passes your XML string to fast-xml-parser — a high-performance JavaScript library that runs entirely client-side. The parser first checks well-formedness: are all tags properly nested? Does the document have a single root element? Are all attribute values quoted? Are all reserved characters (<, >, &, ", ') correctly escaped? If any rule is violated, parsing stops and the error position is reported.

If the XML is well-formed, fast-xml-parser converts it into a JavaScript object tree. Our rendering layer recursively traverses this object and builds a React component tree where each XML element is rendered as a collapsible node with its tag name, attributes, and child elements. Namespace prefixes (cbc:, cac: in XRechnung UBL; rsm:, ram:, udt: in CII) are preserved exactly as they appear in the source — no namespace resolution that might obscure the original structure.

The formatted output is produced by a separate serialization pass: the parsed object tree is serialized back to XML text with consistent 2-space indentation at each nesting level, normalized attribute quoting, and CDATA sections preserved intact. This produces the clean, properly formatted XML that code editors like VS Code or IntelliJ IDEA would display with their auto-format function — without requiring you to install or open an editor.

Use Cases

XRechnung Inspection Before Submission

Before submitting an XRechnung invoice to a government portal (PEPPOL, OZG-RE, ZRE, or a state-level portal), inspect the raw XML to verify that namespace URIs are correct, the CustomizationID matches the required XRechnung version (e.g., xrechnung_3.0), the seller VAT ID (BT-31) is correctly formatted as DE followed by 9 digits, and the payment due date (BT-9) is present. The tree view makes each business term immediately navigable without searching through raw text.

SOAP and XML API Debugging

SOAP web services return responses as densely-packed XML envelopes that are nearly unreadable inline in browser DevTools or Postman. Paste the raw response and instantly get a formatted, navigable tree that shows the Envelope, Header, Body, and Fault structures clearly. This also works for any XML-based REST API, OData $metadata responses, or WCF service responses.

Build and Configuration Files

Maven pom.xml, Spring application context XML, Android AndroidManifest.xml, NuGet .nuspec files, and MSBuild .csproj files are all XML. Our viewer helps you quickly identify deeply nested dependency declarations, missing closing tags, incorrect attribute values, and structural inconsistencies — without needing to open a full IDE.

SVG, Office, and Document Formats

SVG vector graphics, Microsoft Office .docx/.xlsx (which are ZIP archives containing XML), and OpenDocument .odt files are all XML-based. Inspecting the element hierarchy of an SVG reveals path data, transform attributes, and clip-path definitions that are invisible in a graphics editor. For Office files, unzip the .docx and inspect word/document.xml to understand paragraph styles, table structures, and content controls.

Example: XRechnung UBL Structure

This example shows the typical UBL XML structure of an XRechnung 3.0 invoice. The viewer makes namespace prefixes (cbc:, cac:) and the hierarchy of business terms (BT-1, BT-29, BT-31) immediately visible in the collapsible tree.

<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
         xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
         xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
  <cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_3.0</cbc:CustomizationID>
  <cbc:ID>INV-2025-001</cbc:ID>
  <cbc:IssueDate>2025-01-15</cbc:IssueDate>
  <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
  <cac:AccountingSupplierParty>
    <cac:Party>
      <cbc:EndpointID schemeID="0088">4012345000009</cbc:EndpointID>
      <cac:PostalAddress>
        <cbc:StreetName>Example Street 1</cbc:StreetName>
        <cbc:CityName>Berlin</cbc:CityName>
        <cbc:PostalZone>10115</cbc:PostalZone>
      </cac:PostalAddress>
    </cac:Party>
  </cac:AccountingSupplierParty>
</Invoice>

Sample XRechnung UBL XML — paste this snippet into the viewer to see the tree structure instantly. Notice how cbc:CustomizationID identifies the exact standard version, and cbc:InvoiceTypeCode 380 means a standard commercial invoice.

Tips & Limitations

Tips

  • Use Ctrl+Enter as a keyboard shortcut to trigger parsing without reaching for the mouse — useful when iterating quickly on XML edits.
  • Click chevrons in the tree view to collapse large sub-trees. For XRechnung, collapsing AccountingSupplierParty and AccountingCustomerParty lets you focus on line items and tax totals.
  • The "Copy formatted" button copies fully indented XML — ideal for code reviews, JIRA tickets, and documentation where the raw minified version would be hard to read.
  • Namespace prefixes (cbc:, cac:, rsm:, ram:, udt:, etc.) are correctly preserved in both the tree view and formatted output.

Limitations

  • The tool checks well-formedness but not schema validation (XSD) or Schematron rule validation. A document can be well-formed but still violate XRechnung business rules.
  • For full XRechnung compliance — including KOSIT Schematron rules (BR-DE-1 through BR-DE-31) and PEPPOL BIS checks — use the dedicated XRechnung Viewer tool.
  • Free users are limited to 500 KB; larger files require a Pro account. A typical XRechnung invoice is 5–50 KB, so free users can process virtually all real-world invoices.
  • Very large XML files (>5 MB, e.g., bulk export files from ERP systems) may slow the browser since all processing is client-side. For files above 1 MB, consider upgrading to Pro and processing in modern Chrome or Firefox for best performance.

Frequently Asked Questions

Is my XML data stored on your servers?

No. All XML parsing and formatting happens entirely in your browser using the fast-xml-parser JavaScript library. Your data never leaves your device, is never transmitted over the network, and is never stored on any server. This makes docutools.pro fully GDPR-compliant for processing sensitive business documents like invoices, contracts, and financial data.

What's the maximum file size I can process?

Free users can process XML files up to 500 KB. A typical XRechnung invoice is between 5 KB and 50 KB, so virtually all real-world invoices fall well within the free limit. Pro subscribers have no file size limit and can process even multi-megabyte XML documents including large ERP export files, bulk order XMLs, and full OpenDocument files.

Can I use this to validate XRechnung XML?

This tool validates XML syntax (well-formedness) — it checks that tags are properly nested, all attributes are quoted, and the document has a single root element. However, it does not perform XRechnung-specific Schematron validation. For full XRechnung compliance checking including KOSIT business rules (BR-DE-1 through BR-DE-31), namespace URI checks, mandatory field presence, and PEPPOL BIS validation, use our dedicated XRechnung Viewer tool.

Does the viewer support XML namespaces?

Yes. Our parser correctly handles XML namespaces, CDATA sections, processing instructions, and attributes. Namespace prefixes (like cbc:, cac: in XRechnung UBL, or rsm:, ram: in CII) are displayed in the tree view exactly as they appear in the source document. Namespace URI declarations (xmlns:cbc="...") are shown as attributes on the root element.

What is the difference between well-formed and valid XML?

Well-formed XML follows basic syntax rules: tags are properly nested, there is exactly one root element, all attributes are quoted, and reserved characters are escaped. Any XML parser can read well-formed XML. Valid XML additionally conforms to a specific schema — either a DTD (Document Type Definition) or an XSD (XML Schema Definition). XRechnung adds a third layer: Schematron rules (a pattern-based validation language) that check business logic like 'if PaymentMeans code is 58, then PayeeFinancialAccount IBAN must be present'. Our viewer handles well-formedness; full validity requires dedicated XRechnung validators.

Can I view XRechnung UBL and CII files?

Yes. Both UBL (the default XRechnung XML syntax used for most public procurement) and CII (Cross-Industry Invoice, used in ZUGFeRD and as an alternative XRechnung syntax) are standard XML files and can be viewed and formatted in our XML viewer. For detailed field-by-field interpretation of XRechnung data — mapping XML paths to business term names like BT-1 (Invoice number) or BT-31 (Seller VAT ID) — use the XRechnung Viewer tool.

What is CDATA in XML?

CDATA (Character Data) sections are XML constructs that allow you to include blocks of text containing characters that would otherwise require escaping — primarily <, >, and &. A CDATA section is wrapped in <![CDATA[...]]>. Everything inside is treated as raw character data, not XML markup. CDATA sections are commonly used in XML configuration files and SOAP messages to embed HTML fragments or script code. Our viewer renders CDATA sections correctly in the tree view, showing them as a special node type.

How does XML relate to JSON?

Both XML and JSON are data interchange formats used to serialize structured data. XML is older (W3C spec 1998), more verbose, and supports namespaces, mixed content (text and elements interleaved), schema validation (XSD), and transformation (XSLT). JSON is simpler, more compact, and directly maps to JavaScript object syntax — making it dominant for REST APIs and browser-side applications. XRechnung uses XML specifically because XML's namespace and schema validation capabilities allow legally binding, machine-verifiable invoice exchange. For most web API work, JSON is the pragmatic choice; for regulated document exchange, XML remains standard.

Can I convert XML to JSON using this tool?

Our XML Viewer focuses on tree visualization and formatted XML output. XML-to-JSON conversion is a separate task that requires careful decisions: how to represent XML attributes in JSON (e.g., as @attribute keys), how to handle mixed content (text + child elements), and how to handle namespaces. Libraries like fast-xml-parser (JavaScript), xmltodict (Python), or JAXB (Java) handle this conversion with configurable mappings. If you need a quick conversion, pasting the formatted XML into an AI assistant (with conversion rules specified) is a practical approach.

What are XML processing instructions?

Processing instructions (PIs) are special XML constructs that pass directives to the application reading the document. The most common is the XML declaration at the top: <?xml version="1.0" encoding="UTF-8"?>. Other common PIs include <?xml-stylesheet type="text/xsl" href="invoice.xsl"?> for XSLT stylesheets, and application-specific instructions. PIs are not XML elements — they do not appear in the element hierarchy but are preserved in the document and visible in our tree view.

Why does my XML contain BOM characters and how do I remove them?

A BOM (Byte Order Mark) is a Unicode marker (U+FEFF) that sometimes appears at the very beginning of UTF-8 files created by Windows tools. In XML, a BOM before the <?xml?> declaration is technically not allowed by the XML spec and will cause parsers to fail with an 'illegal character at offset 0' error. To remove it, open the file in a text editor that shows encoding details (VS Code, Notepad++), change the encoding to 'UTF-8 without BOM', and save. Our viewer reports this error clearly so you can fix it before processing.

Related Tools