XML interview question · Most asked

Compare DTD, XML Schema (XSD), RELAX NG and Schematron.

Create a free account to save this page, take notes and track your progress. Sign in

Summary

DTD: the original, non-XML syntax, no data types or namespaces, and entity features that cause security issues. XSD: XML syntax, rich data types, namespaces, reuse, the enterprise standard. RELAX NG: simpler, readable grammar (compact syntax), used by DocBook, ODF and EPUB. Schematron: XPath-based rules with human messages for business constraints that grammars can't express.

Longer Answer

A strong setup combines a grammar (XSD or RELAX NG) for structure with Schematron for rules like "total equals the sum of lines", as used for EU e-invoicing (EN 16931).

Key Points

  • DTD: legacy, untyped.
  • XSD: types and namespaces.
  • RELAX NG: simpler grammar.
  • Schematron: business rules.

Deep dive: XML Tutorial: RELAX NG and Schematron

Explanation

What interviewers look for

Correct strengths and a combined approach.

More most-asked XML questions

← All XML questions

Was this page helpful?