XML workbench
Check XML is well-formed (with line and column), format or minify it, browse it as a tree, run XPath 1.0 queries with namespaces, convert to and from JSON, and preview XSLT transforms.
Added
How to use it
Editor and tree
Paste or open a document. It is checked as you type: mismatched or unclosed tags, unquoted
or duplicate attributes, a bare &, text outside the root, or a second root element are
reported with the line and column, a caret under the spot, and Go to error.
-
Format re-indents (2 spaces, 4 spaces, or tab). Mixed content such as
<p>a <i>b</i> c</p>stays on one line so no whitespace is added inside it. Minify strips comments and insignificant whitespace. Cmd/Ctrl+Enter formats. -
Escape / Unescape convert the whole text to and from XML entities, for embedding XML in an attribute or a string.
-
The tree folds and unfolds; click an element to select its source in the editor.
XPath
Queries run in the browser’s XPath 1.0 engine against the editor’s document. Results may be
nodes, a number (count(//item), sum(//price)), a string, or a boolean.
Namespaced documents need prefixes even for the default namespace. Every prefix declared in
the document is available, and the default namespace is bound to c and default, so
//c:book/c:title works on the sample. Add more as prefix=uri lines.
XML ↔ JSON and XSLT
XML → JSON uses the common convention: attributes become "@name", text becomes "#text"
(or a plain string when there is nothing else), and repeated elements become arrays. JSON →
XML reverses it. Tick the option to turn numbers and booleans into JSON types.
The XSLT tab applies an XSLT 1.0 stylesheet to the document. It uses the browser’s
XSLTProcessor where one exists. Chrome has removed native XSLT, so there it loads the
JavaScript xslt-processor engine instead. HTML output is shown in a sandboxed frame, and
the result source can be copied.
Sharing
Share link copies a URL that opens this tool exactly as configured. ?xml= with ?xpath= (and ns), or the conversion direction jdir; stylesheets and longer documents are packed into ?s=.
For example: xml/?xml=%3Ca%3E%3Cb%3E1%3C%2Fb%3E%3C%2Fa%3E&xpath=%2F%2Fb.
Feedback is a gift. Something to improve, a feature to add, or a bug? Tell me.
Runs entirely in your browser; nothing you type leaves this page.