XML interview question · Most asked
What is XML and where is it still used today?
Summary
XML is a text format for structured data and documents where you define your own tags, nested into a tree, with strict syntax rules and optional schemas. It's still central to Office files (.docx, .xlsx), SVG, EPUB, RSS/Atom, sitemaps, SOAP services, finance (ISO 20022), healthcare (HL7 CDA), e-invoicing (UBL), publishing, and build/configuration files such as Maven and Android.
Longer Answer
JSON replaced XML for most web APIs, but XML remains strong where documents with markup, long-lived standards and schema-validated contracts matter. A good answer acknowledges both.
Key Points
- Self-describing tree of elements and attributes.
- Strict well-formedness; optional schemas.
- Dominant in documents and enterprise standards.
- JSON won most web APIs.
Deep dive: XML Tutorial: XML Introduction
Explanation
What interviewers look for
Concrete current uses, not just 'it's old'.
More most-asked XML questions
- Your XPath query returns nothing, but the elements are clearly there. What's the likely cause?
- What's the difference between well-formed and valid XML?
- Compare DOM, SAX and StAX (or pull parsing).
- Explain XML namespaces and the default namespace.
- What is an XXE attack and how do you prevent it?
- How does XSLT work? Explain templates and apply-templates.
- Which characters must be escaped in XML, and what is CDATA?
- Compare DTD, XML Schema (XSD), RELAX NG and Schematron.