chapter 3: XML be Used
How can XML actually be used in the real world?
I will explain it like we are sitting together and I’m showing you different real-life situations where XML appears, why people chose it, what it’s doing there, and how it behaves in each case.
We’ll go through practical usage scenarios with examples, real names of formats/systems, and honest pros/cons.
1. Configuration Files (Very Common Use)
Where you see it: Many programs, servers, tools, IDEs, frameworks, build systems, etc. store their settings in XML.
Why XML?
- Human readable & editable
- Hierarchical structure fits configuration very well
- Many programming languages have excellent built-in XML parsers
- Comments are supported → very useful in config files
Real examples you have probably seen:
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<!-- Apache Tomcat server.xml (very classic example) --> <Server port="8005" shutdown="SHUTDOWN"> <Service name="Catalina"> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"/> <Engine name="Catalina" defaultHost="localhost"> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Context path="" docBase="myapp" reloadable="true"/> </Host> </Engine> </Service> </Server> |
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<!-- log4j2.xml or logback.xml – logging configuration --> <Configuration status="WARN"> <Appenders> <Console name="Console" target="SYSTEM_OUT"> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> </Console> <File name="File" fileName="logs/app.log"> <PatternLayout pattern="%d %p %c{1.} [%t] %m%n"/> </File> </Appenders> <Loggers> <Root level="info"> <AppenderRef ref="Console"/> <AppenderRef ref="File"/> </Root> </Loggers> </Configuration> |
Other common places:
- Maven pom.xml
- Gradle (older versions used XML)
- Spring applicationContext.xml / dispatcher-servlet.xml
- Hibernate hibernate.cfg.xml
- Android AndroidManifest.xml
- Java EE / Jakarta EE deployment descriptors (web.xml, ejb-jar.xml, etc.)
2. Data Exchange Between Different Systems (Classic XML Strength)
Main idea: Two companies / departments / applications written in completely different technologies need to send structured data to each other.
Very common real cases:
- Bank ↔ Company (salary payments, invoices)
- Government systems ↔ Businesses (GST returns, e-invoicing in India)
- ERP system ↔ Accounting software
- Hospital management system ↔ Lab system
- Supplier ↔ Retailer (purchase orders, delivery notes)
Real Indian example – e-Invoicing (very widely used since 2020–2021)
The Indian government (GSTN) defined very strict XML schema for electronic invoices.
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
<Invoice> <cbc:ID>INV/2025/0789</cbc:ID> <cbc:IssueDate>2025-06-22</cbc:IssueDate> <cbc:InvoiceTypeCode name="Tax Invoice">INV</cbc:InvoiceTypeCode> <cac:AccountingSupplierParty> <cac:Party> <cbc:Name>TechTrend Innovations Pvt Ltd</cbc:Name> <cac:PartyIdentification> <cbc:ID schemeID="GSTIN">36AAECT4567P1Z2</cbc:ID> </cac:PartyIdentification> </cac:Party> </cac:AccountingSupplierParty> <cac:AccountingCustomerParty> <cac:Party> <cbc:Name>Creative Minds Academy</cbc:Name> <cac:PartyIdentification> <cbc:ID schemeID="GSTIN">29AABCM9876Q1Z5</cbc:ID> </cac:PartyIdentification> </cac:Party> </cac:AccountingCustomerParty> <cac:TaxTotal> <cbc:TaxAmount currencyID="INR">38610.00</cbc:TaxAmount> </cac:TaxTotal> <cbc:PayableAmount currencyID="INR">253110.00</cbc:PayableAmount> </Invoice> |
(Notice the namespaces – cbc:, cac: → this is UBL – Universal Business Language standard)
3. Industry & Domain-Specific Standards (Huge XML Usage Area)
Many industries created very detailed XML standards that are still alive in 2025–2026.
| Domain | Important XML formats / standards | Still widely used? |
|---|---|---|
| Finance | FIXML, FpML, ISO 20022 (parts), XBRL | Yes |
| Healthcare | HL7 CDA, FHIR (XML version), DICOM SR | Very much |
| Publishing / Books | DocBook, DITA, EPUB (older versions), JATS | Yes |
| Government / Legal | NIEM (US), UBL, e-CODEX, many national e-Gov formats | Very strong |
| Office Documents | Microsoft Office Open XML (.docx, .xlsx, .pptx are ZIP + XML) | Everywhere |
| Vector Graphics | SVG (Scalable Vector Graphics) | Very strong |
| Syndication / News | RSS 2.0, Atom 1.0 | Still used |
| Web Services (older) | SOAP + WSDL + XML payloads | Declining but alive |
Example – very small RSS feed (still used by many blogs, news sites, podcasts)
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<?xml version="1.0" encoding="utf-8"?> <rss version="2.0"> <channel> <title>TechCrunch</title> <link>https://techcrunch.com</link> <description>Technology News and Analysis</description> <item> <title>New AI startup raises $200M</title> <link>https://techcrunch.com/2025/06/22/ai-startup-funding</link> <pubDate>Sun, 22 Jun 2025 14:30:00 GMT</pubDate> <description>Company building next-gen reasoning models...</description> </item> </channel> </rss> |
4. File Formats That Are Actually XML Under the Hood
Many files you use every day are XML inside:
| File type | What it really is | You can open with text editor and see XML |
|---|---|---|
| .docx | ZIP file containing many XML files | Yes |
| .xlsx | ZIP + XML (spreadsheetML) | Yes |
| .pptx | ZIP + XML | Yes |
| .odt, .ods | OpenDocument format (very XML-heavy) | Yes |
| .svg | Pure XML | Yes |
| .drawio / .dio | diagrams.net draw.io files | Yes |
| .ui (Qt) | Qt Designer UI files | Yes |
5. When XML is Still Chosen Over JSON (2025–2026 reality)
People still pick XML instead of JSON when:
- Need very strict validation (XSD schema)
- Need namespaces (multiple vocabularies in one document)
- Industry/government mandates XML (e-invoice, HL7, UBL, ISO 20022…)
- Need comments inside the data file
- Need mixed content (text + tags mixed – common in publishing)
- Dealing with very old systems that only understand XML
- Processing very large documents with streaming parsers (StAX, SAX)
JSON is usually simpler and more compact — but XML is better when strict rules, namespaces, or legacy systems are involved.
Quick Summary – Where You Will Most Likely Meet XML Today
- Configuration files (Maven, Spring, Tomcat, Android manifest…)
- Enterprise data exchange (invoices, orders, GST e-invoice, banking)
- Industry standards (healthcare HL7, finance ISO 20022, publishing DocBook/DITA)
- Office documents (.docx, .xlsx, .pptx are secretly XML)
- Legacy SOAP web services (many banks, governments, insurance still use them)
- SVG graphics, RSS/Atom feeds, some configuration formats
Would you like to go deeper into any of these real usage areas?
- How real e-invoicing XML looks in India (with full example)
- What namespaces really do and why they matter
- Difference between XML used in config vs XML used in data exchange
- How companies validate XML (XSD, Schematron)
- SOAP vs REST – why SOAP is XML-heavy
- Modern alternatives and when people moved away from XML
Just tell me which direction interests you most! 😊
