XML Data
Web & DevelopmentXML is a tagged data syntax used for many purposes, including sitemaps and settings. Well-formed tags do not guarantee a document matches the consuming application’s requirements.
- What it is used for
- Tagged structured documents, settings and data exchange
- What the file contains
- Text
All sections, questions and sources
Content reviewed: · Editor:Kai
Opening steps
Choose your environment or purpose to see its steps.
Menu labels and support vary by app, OS and version. Preserve the original before making changes.
Troubleshooting by symptom
- Parse failure: inspect closing tags, quotes, nesting and escaped special characters.
- Blank display: XML does not define a generic HTML-like presentation; use the intended application.
- Application rejects content: inspect namespaces, required elements, version and schema.
- Ampersand error: inspect required escaping of & or < in text.
- Matching tag names are rejected: inspect namespace URIs and prefix mappings.
- Declaration/encoding mismatch: inspect the actual saved encoding rather than changing the declaration alone.
XML → JSON / CSV
- Map elements, attributes and repeated nodes to the destination structure.
- Convert a copy and inspect omissions, ordering, encoding and types.
- Compare keys, record counts and types before/after conversion and document unsupported items.
Attributes, namespaces and mixed text/element content may not fit a simple table.
Elements, attributes and text
Distinguish attribute values from element text. Check formatting effects where whitespace/order is meaningful.
Successful parsing establishes well-formedness; validate application requirements separately.
<?xml version="1.0" encoding="UTF-8"?>
<item id="1"><name>Example</name></item>Source for these steps:W3C · XML 1.0 (Fifth Edition) / Python Software Foundation · XML Processing Modules
External references and conversion
XML can reference external entities. Inspect untrusted data with tools that restrict external retrieval.
Compare attributes, namespaces, empty elements and counts after conversion and retain the XML.
Source for these steps:W3C · XML 1.0 (Fifth Edition) / Python Software Foundation · XML Processing Modules
Related-format differences
| Format | Main role | Selection notes |
|---|---|---|
| XML | Tagged data with attributes | Inspect schema and namespaces |
| JSON | Key/value hierarchy | Requires mapping rules |
| HTML | Web document | Parsing rules differ from XML |
Handling and security
External entities/references require care. Avoid importing unknown XML into administrative systems and use appropriate parser settings.
Questions and answers
Can any application use any XML?
No; identify its schema and intended application.
Is a browser tree view an error?
It can be normal for XML data.
Does renaming XML to HTML create a page?
No; renaming does not transform the document structure.
Is XML specific to Excel?
It has many uses. Choose an application based on the producer’s schema.
Is XML-to-JSON equivalent?
It needs mapping rules for attributes, namespaces, element order and mixed content.
Format facts: name, steward and MIME type
- Formal name
- Extensible Markup Language
- Steward / specification
- W3C
- MIME type
- application/xml
Primary and official sources
- StandardXML 1.0 (Fifth Edition)
Defines XML well-formedness, declarations and elements.
W3C · Link checked: - StandardHTML Living Standard
Specification for HTML documents, elements and resources.
WHATWG · Link checked: - Project documentationXML Processing Modules
XML parsers and security considerations.
Python Software Foundation · Link checked: