Home Text Tools Math & Numbers Developer Tools Date & Time Image Tools Blog
XML Formatter & Beautifier

Read a SOAP or API Response by Formatting Minified XML

A one-line XML response is nearly unreadable. Format it, find the fields you need, and spot faults and namespace problems quickly.

The response came back as a single 4,000-character line, and somewhere inside it is the transaction ID or error code you need. Formatting the XML turns that wall of angle brackets into an indented tree where each element sits on its own line.

XML Formatter & Beautifier FREE online toolRuns in your browser. No sign-up, nothing to install. Open the tool

What you are looking at

A SOAP message wraps its data in an Envelope element, usually with a Header and a Body. The useful part is inside the Body, often nested several levels deep and decorated with namespace prefixes such as soap: or ns2:. Those prefixes are noise at first glance, but they tell you which schema each element belongs to.

Many banking, payment and government systems still speak SOAP or return plain XML, and their responses often arrive minified to save bandwidth.

If you work with the same service every day, keep a formatted sample of a good response and a failed one. Comparing a fresh response against those references shows at a glance which element has changed, which is much faster than reading a new payload from scratch each time.

A quick workflow

  1. Copy the raw response from your logs, a Postman-style client or the browser network tab.
  2. Paste it into the XML Formatter and run Format.
  3. Scan for the Body element and collapse your attention to it, ignoring the Envelope and Header unless you need them.
  4. Search the formatted text for the field you want, such as a status or reference number.
  5. If the response contains a Fault element, read faultcode and faultstring first, since they usually explain the failure.
  6. Copy the part you need into your ticket or code.

Finding the value you need

Once formatted, structure matters. Elements that repeat, such as line items or transactions, appear as sibling blocks with the same name. Attributes sit inside the opening tag, for example currency="EUR" on an amount element, and are easy to miss when everything is on one line.

Beware of values that look like text but are really CDATA sections or escaped XML. Some legacy services return an inner XML document as an escaped string inside one element, with characters like < instead of angle brackets. You will need to unescape and format that inner payload separately.

Be aware of whitespace inside values. A formatter adds indentation between elements, and this one also trims spaces at the start and end of text values. If a value looks different after formatting, compare it with the original before you copy it into a test or a ticket, because some systems treat spaces as significant.

  • Check the root element name to confirm you received the right type of message.
  • Look at attributes as well as child elements.
  • Watch for empty tags, which can mean no data rather than an error.
  • Note the namespace URI if you need to write XPath or code against it.

Troubleshooting malformed XML

If formatting fails or produces strange output, the XML is probably not well-formed. Typical causes are an unescaped ampersand in a value, mismatched opening and closing tags, a stray character before the XML declaration, or truncated output from a log with a length limit.

A response cut short in a log line can look almost valid until the last few characters. Check the end of the paste first. If the closing Envelope tag is missing, ask for the full payload rather than guessing.

Be careful with sensitive data. Responses from payment or banking systems can contain account numbers and personal details, so redact them before sharing the formatted version in chat or a ticket.

Try the free XML Formatter & Beautifier
Runs in your browser. No sign-up, nothing to install.

Comments (0)

No comments yet. Be the first to share a thought.