All developer tools

XML Tools

Format and validate XML, test XPath expressions, and convert XML documents to JSON.

XML tooling starts with a distinction between a document that is well formed and one that satisfies a particular business vocabulary. The validator checks syntax such as balanced tags and a single root. It does not prove an XSD, DTD, or partner-specific contract is satisfied. Formatting helps with inspection, but whitespace inside mixed content can be meaningful, so compare carefully before saving a document intended for a downstream parser.

XPath is useful when you already know what nodes you need and want to test a reusable expression. XML to JSON is convenient for application code, though it has to choose a representation for attributes, repeated elements, and text. Those mapping choices deserve a small sample test before converting a production feed. If a source document uses namespaces, read the namespace declarations before assuming an unprefixed XPath will match its elements.

Choose the right tool

  • XML Validator: Find malformed markup before investigating schema rules or conversion output.
  • XPath Tester: Test a selection against the actual document when nesting or namespaces make manual searching unreliable.
  • XML to JSON: Inspect a sample mapping before consuming XML in a JSON-oriented program.

A practical workflow

For a supplier feed, begin with XML Validator and fix any structural error. Use XML Formatter to inspect the document without discarding comments or CDATA. Next, test an XPath for the item records you intend to import. Convert one item and then two items to JSON, comparing the resulting object and array shapes before writing consuming code. This sequence catches cardinality changes that often appear only after a real feed grows.

Things to check

  • Spaces around inline child elements may be part of the text. Formatting such mixed content as if it were only data can alter what readers see. See XML Formatter.
  • A default namespace changes name matching. An expression that looks right may return no nodes without a namespace-aware approach. See XPath Tester.
  • A single child and repeated children can map to different JSON types. Plan for both when a feed is not fixed in size. See XML to JSON.

Related guides